1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-31 01:29:51 +02:00
This commit is contained in:
Oliver Vogel
2014-05-11 20:03:53 +02:00
parent 59707c065c
commit 300d010665

View File

@@ -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);