diff options
author | Antonio Gallo <tonicucoz@gmail.com> | 2011-07-28 20:27:23 +0000 |
---|---|---|
committer | Antonio Gallo <tonicucoz@gmail.com> | 2011-07-28 20:27:23 +0000 |
commit | e7b3717614621f14695ab6ca6dda6dd17ba3d65c (patch) | |
tree | c8e6061aef3ff7bad5a17e1aecaf441d35e282cb /h-source/Library/Image/Gd/Thumbnail.php | |
parent | 0de74c6879d263645770de3d6b3ce7123f5241d6 (diff) |
added new easygiant library
Diffstat (limited to 'h-source/Library/Image/Gd/Thumbnail.php')
-rw-r--r-- | h-source/Library/Image/Gd/Thumbnail.php | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/h-source/Library/Image/Gd/Thumbnail.php b/h-source/Library/Image/Gd/Thumbnail.php index 742aa17..9bf2500 100644 --- a/h-source/Library/Image/Gd/Thumbnail.php +++ b/h-source/Library/Image/Gd/Thumbnail.php @@ -41,7 +41,9 @@ class Image_Gd_Thumbnail 'defaultImage' => null, 'cropImage' => 'no', 'horizAlign' => 'left', - 'vertAlign' => 'top' + 'vertAlign' => 'top', + 'resample' => 'yes', + 'function' => 'none', ); //set the $this->scaffold->params array @@ -144,10 +146,24 @@ class Image_Gd_Thumbnail //temp image $tmpImg = imagecreatetruecolor($newWidth, $newHeight); - //copy and resize - imagecopyresized($tmpImg, $img, 0, 0, $xSrc, $ySrc,$newWidth, $newHeight, $width, $height); + if ($this->params['resample'] === 'yes') + { + //copy and resample + imagecopyresampled($tmpImg, $img, 0, 0, $xSrc, $ySrc,$newWidth, $newHeight, $width, $height); + } + else + { + //copy and resize + imagecopyresized($tmpImg, $img, 0, 0, $xSrc, $ySrc,$newWidth, $newHeight, $width, $height); + } imagedestroy($img); $img = $tmpImg; + + if (!function_exists($this->params['function'])) { + throw new Exception('Error in <b>'.__METHOD__.'</b>: function <b>'.$this->params['function']. '</b> does not exist'); + } + + $img = call_user_func($this->params['function'],$img); } } @@ -159,7 +175,7 @@ class Image_Gd_Thumbnail //print the image header("Content-type: image/jpeg"); - imagejpeg($img); + imagejpeg($img,null,90); } |