Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[FIX] ImagickBackend

  • Loading branch information...
commit ef3613c8ff95b7e278cb1daa2266edf63772ec2b 1 parent b671c35
Tony Air authored

Showing 1 changed file with 12 additions and 4 deletions. Show diff stats Hide diff stats

  1. +12 4 filesystem/ImagickBackend.php
16 filesystem/ImagickBackend.php
@@ -180,7 +180,7 @@ public function resizeByHeight($height) {
180 180 * @param int $height
181 181 * @return Image_Backend
182 182 */
183   - public function paddedResize($width, $height, $backgroundColor = "FFFFFF") {
  183 + public function paddedResize($width, $height, $backgroundColor = false) {
184 184 if(!$this->valid()) return;
185 185
186 186 $width = round($width);
@@ -192,6 +192,10 @@ public function paddedResize($width, $height, $backgroundColor = "FFFFFF") {
192 192 return $this;
193 193 }
194 194
  195 + if(!$backgroundColor){
  196 + $backgroundColor = new ImagickPixel('transparent');
  197 + }
  198 +
195 199 $new = clone $this;
196 200 $new->setBackgroundColor($backgroundColor);
197 201
@@ -231,7 +235,7 @@ public function paddedResize($width, $height, $backgroundColor = "FFFFFF") {
231 235 * @param int $height
232 236 * @return Image_Backend
233 237 */
234   - public function croppedResize($width, $height) {
  238 + public function croppedResize($width, $height, $backgroundColor = false) {
235 239 if(!$this->valid()) return;
236 240
237 241 $width = round($width);
@@ -243,6 +247,10 @@ public function croppedResize($width, $height) {
243 247 return $this;
244 248 }
245 249
  250 + if(!$backgroundColor){
  251 + $backgroundColor = new ImagickPixel('transparent');
  252 + }
  253 +
246 254 $new = clone $this;
247 255 $new->setBackgroundColor($backgroundColor);
248 256
@@ -268,8 +276,8 @@ public function croppedResize($width, $height) {
268 276 $srcHeight = round( $this->width / $destAR );
269 277 $srcY = round( ($this->height - $srcHeight) / 2 );
270 278 }
271   -
272   - $new->extentImage($width, $height, $destX, $destY);
  279 +
  280 + $new->extentImage($width, $height, $srcX, $srcY);
273 281 }
274 282
275 283 return $new;

0 comments on commit ef3613c

Please sign in to comment.
Something went wrong with that request. Please try again.