Author: sevein
Date: Sat Jul 14 12:57:03 2012
New Revision: 11926

Log:
Fix for issue 2380, ImageMagick black jpegs thumbnails from PDF files

Modified:
   trunk/plugins/sfThumbnailPlugin/lib/sfImageMagickAdapter.class.php

Modified: trunk/plugins/sfThumbnailPlugin/lib/sfImageMagickAdapter.class.php
==============================================================================
--- trunk/plugins/sfThumbnailPlugin/lib/sfImageMagickAdapter.class.php  Sat Jul 
14 11:22:18 2012        (r11925)
+++ trunk/plugins/sfThumbnailPlugin/lib/sfImageMagickAdapter.class.php  Sat Jul 
14 12:57:03 2012        (r11926)
@@ -229,12 +229,12 @@
     $width  = $this->sourceWidth;
     $height = $this->sourceHeight;
     $x = $y = 0;
-    switch (@$this->options['method']) 
+    switch (@$this->options['method'])
     {
       case "shave_all":
         $proportion['source'] = $width / $height;
         $proportion['thumb'] = $thumbnail->getThumbWidth() / 
$thumbnail->getThumbHeight();
-        
+
         if ($proportion['source'] > 1 && $proportion['thumb'] < 1)
         {
           $x = ($width - $height * $proportion['thumb']) / 2;
@@ -295,12 +295,12 @@
       case 'custom':
        $coords = $this->options['coords'];
        if (empty($coords)) break;
-       
+
        $x = $coords['x1'];
        $y = $coords['y1'];
        $width = $coords['x2'] - $coords['x1'];
        $height = $coords['y2'] - $coords['y1'];
-       
+
         if (is_null($thumbDest))
         {
           $command = sprintf(
@@ -331,6 +331,14 @@
     $command .= ' -thumbnail ';
     $command .= $thumbnail->getThumbWidth().'x'.$thumbnail->getThumbHeight();
 
+    // See Qubit issue 2380
+    if ('application/pdf' == $this->getSourceMime())
+    {
+      $command .= ' -flatten ';
+    }
+
+    $command .= $this->getSourceMime();
+
     // absolute sizing
     if (!$this->scale)
     {
@@ -370,7 +378,7 @@
   {
     return $this->sourceMime;
   }
-  
+
   private function getExtract()
   {
     $extract = '';

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to