]> git.mxchange.org Git - friendica.git/commitdiff
Use getImageFormat to know the image format in the constructor.
authorDomovoy <domovoy@errlock.org>
Sun, 22 Jul 2012 13:24:41 +0000 (15:24 +0200)
committerDomovoy <domovoy@errlock.org>
Sun, 22 Jul 2012 13:24:41 +0000 (15:24 +0200)
Since we don't load the image with Imagick constructor, we need to use the [get|set]imageXXX methods.
We should be able to handle the image as if it was loaded from Imagick constructor, so that we don't get lost between the image and its frames.

Also added a debug log so that we get some info on unhandled mime types.

include/Photo.php

index c8a0ac11989d77e99140cac9874ed639998b3b42..bba4603562167864edc7e1a0e2459498fc0d0196 100644 (file)
@@ -47,7 +47,7 @@ class Photo {
             $this->image->readImageBlob($data);
 
             // If it is a gif, it may be animated, get it ready for any future operations
-            if($this->image->getFormat() !== "GIF") $this->image = $this->image->coalesceImages();
+            if($this->image->getImageFormat() !== "GIF") $this->image = $this->image->coalesceImages();
 
             $this->ext = strtolower($this->image->getImageFormat());
         } else {
@@ -460,8 +460,10 @@ class Photo {
                 $quality = get_config('system','jpeg_quality');
                 if((! $quality) || ($quality > 100))
                     $quality = JPEG_QUALITY;
-                if($this->is_imagick())
+                if($this->is_imagick()) {
                     $this->image->setImageFormat('jpeg');
+                    logger('Photo: imageString: Unhandled mime type ('. $this->getType() .'), Imagick format is "'. $this->image->getImageFormat() .'"', LOGGER_DEBUG);
+                }
                 else imagejpeg($this->image,NULL,$quality);
         }