//
// }
-// if(!empty($scaleWidth) || !empty($scaleHeight)){
-// $data = $this->scale($scaleWidth, $scaleHeight);
-// }
+ if(!empty($scaleWidth) || !empty($scaleHeight)){
+ $data = $this->scale($data, $scaleWidth, $scaleHeight);
+ }
if($rotate){
- $data = $this->rotate();
$data = $this->rotate($data);
}
return $imagick->getImageBlob();
}
- function scale($width, $height)
+ function scale($imageBlob = false, $width = 0, $height = 0)
{
+ if(empty($imageBlob)){
+ $imagick = new Imagick($this->getStoreName());
+ } else {
+ $imagick = new Imagick();
+ $imagick->readImageBlob($imageBlob);
+ }
+
+ $imagick->resizeimage($width, $height, Imagick::FILTER_LANCZOS, true, true);
+
+ return $imagick->getImageBlob();
}