mirror of
https://github.com/Intervention/image.git
synced 2025-09-01 09:52:59 +02:00
fix
This commit is contained in:
@@ -40,7 +40,7 @@ class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand
|
|||||||
$image_size = $image->getSize()->align($anchor);
|
$image_size = $image->getSize()->align($anchor);
|
||||||
$canvas_pos = $image_size->relativePosition($canvas_size);
|
$canvas_pos = $image_size->relativePosition($canvas_size);
|
||||||
$image_pos = $canvas_size->relativePosition($image_size);
|
$image_pos = $canvas_size->relativePosition($image_size);
|
||||||
|
|
||||||
if ($width <= $original_width) {
|
if ($width <= $original_width) {
|
||||||
$dst_x = 0;
|
$dst_x = 0;
|
||||||
$src_x = $canvas_pos->x;
|
$src_x = $canvas_pos->x;
|
||||||
@@ -65,7 +65,7 @@ class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand
|
|||||||
// even if background-color is set
|
// even if background-color is set
|
||||||
$transparent = imagecolorallocatealpha($canvas->getCore(), 0, 0, 0, 127);
|
$transparent = imagecolorallocatealpha($canvas->getCore(), 0, 0, 0, 127);
|
||||||
imagealphablending($canvas->getCore(), false); // do not blend / just overwrite
|
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
|
// copy image into new canvas
|
||||||
imagecopy($canvas->getCore(), $image->getCore(), $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h);
|
imagecopy($canvas->getCore(), $image->getCore(), $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h);
|
||||||
|
Reference in New Issue
Block a user