]> git.mxchange.org Git - friendica.git/commitdiff
consistent handling of scaled images when using imagick
authorfriendica <info@friendica.com>
Sun, 30 Sep 2012 10:25:20 +0000 (03:25 -0700)
committerfriendica <info@friendica.com>
Sun, 30 Sep 2012 10:25:20 +0000 (03:25 -0700)
include/Photo.php
mod/item.php

index 4ab58369ec94203b8d1cbd749acdb3012cac87c2..25a2b708038b2a935eea979dcb11e5ff3dbe82b7 100644 (file)
@@ -205,27 +205,6 @@ class Photo {
         if(!$this->is_valid())
             return FALSE;
 
-        if($this->is_imagick()) {
-            /**
-             * If it is not animated, there will be only one iteration here,
-             * so don't bother checking
-             */
-            // Don't forget to go back to the first frame
-            $this->image->setFirstIterator();
-            do {
-
-                               // FIXME - implement horizantal bias for scaling as in followin GD functions
-                               // to allow very tall images to be constrained only horizontally. 
-
-                $this->image->resizeImage($max, $max, imagick::FILTER_LANCZOS, 1, true);
-            } while ($this->image->nextImage());
-
-                       // FIXME - also we need to copy the new dimensions to $this->height, $this->width as other functions
-                       // may rely on it.
-
-            return;
-        }
-
         $width = $this->width;
         $height = $this->height;
 
@@ -283,6 +262,28 @@ class Photo {
         }
 
 
+        if($this->is_imagick()) {
+            /**
+             * If it is not animated, there will be only one iteration here,
+             * so don't bother checking
+             */
+            // Don't forget to go back to the first frame
+            $this->image->setFirstIterator();
+            do {
+
+                               // FIXME - implement horizantal bias for scaling as in followin GD functions
+                               // to allow very tall images to be constrained only horizontally. 
+
+                $this->image->scaleImage($dest_width, $dest_height);
+            } while ($this->image->nextImage());
+
+                       // FIXME - also we need to copy the new dimensions to $this->height, $this->width as other functions
+                       // may rely on it.
+
+            return;
+        }
+
+
         $dest = imagecreatetruecolor( $dest_width, $dest_height );
         imagealphablending($dest, false);
         imagesavealpha($dest, true);
@@ -400,8 +401,6 @@ class Photo {
         if(!$this->is_valid())
             return FALSE;
 
-        if($this->is_imagick())
-            return $this->scaleImage($min);
 
         $width = $this->width;
         $height = $this->height;
@@ -438,6 +437,8 @@ class Photo {
             }
         }
 
+        if($this->is_imagick())
+            return $this->scaleImage($dest_width,$dest_height);
 
         $dest = imagecreatetruecolor( $dest_width, $dest_height );
         imagealphablending($dest, false);
@@ -460,7 +461,7 @@ class Photo {
         if($this->is_imagick()) {
             $this->image->setFirstIterator();
             do {
-                $this->image->resizeImage($dim, $dim, imagick::FILTER_LANCZOS, 1, false);
+                $this->image->scaleImage($dim, $dim);
             } while ($this->image->nextImage());
             return;
         }
index 712174b0ae79ee15bc014144912b315e3bd71f31..de6bce972ce2d08ad9dfad63caca8bcf4fff1039 100644 (file)
@@ -994,6 +994,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
                                                intval($tagcid),
                                                intval($profile_uid)
                                );
+                       }
                        else {
                                $newname = str_replace('_',' ',$name);