From 300d010665c05c3b5c4b3bbe019b290295474650 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Sun, 11 May 2014 20:03:53 +0200 Subject: [PATCH] fix --- src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php b/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php index 31482df3..2d562494 100644 --- a/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php +++ b/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php @@ -40,7 +40,7 @@ class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand $image_size = $image->getSize()->align($anchor); $canvas_pos = $image_size->relativePosition($canvas_size); $image_pos = $canvas_size->relativePosition($image_size); - + if ($width <= $original_width) { $dst_x = 0; $src_x = $canvas_pos->x; @@ -65,7 +65,7 @@ class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand // even if background-color is set $transparent = imagecolorallocatealpha($canvas->getCore(), 0, 0, 0, 127); imagealphablending($canvas->getCore(), false); // do not blend / just overwrite - imagefilledrectangle($canvas->getCore(), $dst_x, $dst_y, $src_w + 1, $src_h + 1, $transparent); + imagefilledrectangle($canvas->getCore(), $dst_x, $dst_y, $dst_x + $src_w - 1, $dst_y + $src_h - 1, $transparent); // copy image into new canvas imagecopy($canvas->getCore(), $image->getCore(), $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h);