]> git.mjollnir.org Git - s9y.git/commitdiff
Fix PDF thumbnail creation.
authorgarvinhicking <garvinhicking>
Fri, 13 May 2005 12:30:55 +0000 (12:30 +0000)
committergarvinhicking <garvinhicking>
Fri, 13 May 2005 12:30:55 +0000 (12:30 +0000)
docs/NEWS
include/functions_images.inc.php

index 77c28bd52474fb2b840f52ac8a618e3a12578bfc..fd203e5259709d6a023d26018ddf1c2fd651cc69 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,9 @@
 Version 0.8.1 ()
 ------------------------------------------------------------------------
 
+    * Fix missing PDF thumbnail creation (imagemagick only)
+      (garvinhicking)
+
     * Fix possible arbitrary media file upload for editors
       (garvinhicking, sesser, nohn)
           
index d8ca99a58eb2840aef3649b22183fedc5b25704f..0b7d7623bd2743bd520106c6af62eb5321266b85 100644 (file)
@@ -312,15 +312,17 @@ function serendipity_makeThumbnail($file, $directory = '', $size = false) {
         } else {
             $r = array($size, $size);
             $newSize = $size . 'x' . $size;
-            if ($ft_mime != 'application/pdf') {
-               $cmd     = escapeshellcmd($serendipity['convert']) . ' -antialias -scale '. serendipity_escapeshellarg($newSize) .' '. serendipity_escapeshellarg($infile) .' '. serendipity_escapeshellarg($outfile);
+            if ($fdim['mime'] == 'application/pdf') {
+               $cmd     = escapeshellcmd($serendipity['convert']) . ' -antialias -flatten -scale '. serendipity_escapeshellarg($newSize) .' '. serendipity_escapeshellarg($infile) .' '. serendipity_escapeshellarg($outfile . '.png');
             } else {
-               $cmd     = escapeshellcmd($serendipity['convert']) . ' -antialias -flatten -scale '. serendipity_escapeshellarg($newSize) .' '. serendipity_escapeshellarg($infile) .' '. serendipity_escapeshellarg($outfile .'.png');
+               $cmd     = escapeshellcmd($serendipity['convert']) . ' -antialias -scale '. serendipity_escapeshellarg($newSize) .' '. serendipity_escapeshellarg($infile) .' '. serendipity_escapeshellarg($outfile);
             }
             exec($cmd, $output, $result);
             if ( $result != 0 ) {
                 echo '<div class="serendipityAdminMsgError">'. sprintf(IMAGICK_EXEC_ERROR, $cmd, $output[0], $result) .'</div>';
                 $r = false; // return failure
+            } else {
+               touch($outfile);
             }
             unset($output, $result);
         }
@@ -1258,11 +1260,11 @@ function serendipity_getimagesize($file, $ft_mime = '', $suf = '') {
     }
 
     if ($ft_mime == 'application/pdf') {
-       $fdim = array(1000,1000,24, '', 'bits'=> 24, 'channels' => '3', 'mime' => 'application/pdf');
+        $fdim = array(1000,1000,24, '', 'bits'=> 24, 'channels' => '3', 'mime' => 'application/pdf');
+    } else {
+        $fdim = @getimagesize($file);
     }
 
-    $fdim = @getimagesize($file);
-
     if (is_array($fdim)) {
         if (empty($fdim['mime'])) {
             $fdim['mime'] = $ft_mime;