From 3f3a8974b942fb68c7941e5c5f8db70231977906 Mon Sep 17 00:00:00 2001 From: spiderr Date: Thu, 19 Jul 2012 14:43:41 -0400 Subject: rework upload files to have an option to save as original.ext, file_name is still recorded in the database properly. rework PDF thumbnailing. --- plugins/processor.magickwand.php | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'plugins/processor.magickwand.php') diff --git a/plugins/processor.magickwand.php b/plugins/processor.magickwand.php index 4c06fe9..8b8cac0 100644 --- a/plugins/processor.magickwand.php +++ b/plugins/processor.magickwand.php @@ -22,20 +22,8 @@ function liberty_magickwand_resize_image( &$pFileHash ) { $magickWand = NewMagickWand(); $pFileHash['error'] = NULL; $ret = NULL; - $isPdf = preg_match( '/pdf/i', $pFileHash['type'] ); + if( !empty( $pFileHash['source_file'] ) && is_file( $pFileHash['source_file'] ) && filesize( $pFileHash['source_file'] ) ) { - // This has to come BEFORE the MagickReadImage - if( $isPdf ) { - // has a customer pdf rasterization function been defined? - if( function_exists( 'liberty_rasterize_pdf' ) && $rasteredFile = liberty_rasterize_pdf( $pFileHash['source_file'] ) ) { - $pFileHash['source_file'] = $rasteredFile; - $isPdf = FALSE; - } else { - MagickSetImageUnits( $magickWand, MW_PixelsPerInchResolution ); - $rez = empty( $pFileHash['max_width'] ) || $pFileHash['max_width'] == MAX_THUMBNAIL_DIMENSION ? 250 : 72; - MagickSetResolution( $magickWand, 300, 300 ); - } - } if( $error = liberty_magickwand_check_error( MagickReadImage( $magickWand, $pFileHash['source_file'] ), $magickWand ) ) { // $pFileHash['error'] = $error; $destFile = liberty_process_generic( $pFileHash, FALSE ); @@ -48,10 +36,6 @@ function liberty_magickwand_resize_image( &$pFileHash ) { MagickSetImageColorspace( $magickWand, MW_RGBColorspace ); $pFileHash['colorspace_conversion'] = TRUE; } - if( $isPdf ) { - MagickResetIterator( $magickWand ); - MagickNextImage( $magickWand ); - } MagickSetImageCompressionQuality( $magickWand, $gBitSystem->getConfig( 'liberty_thumbnail_quality', 85 )); $iwidth = round( MagickGetImageWidth( $magickWand ) ); $iheight = round( MagickGetImageHeight( $magickWand ) ); -- cgit v1.3