Improved image handling logic
The image processing logic has been updated to better handle optional parameters. Previously, the code would always pad and resize the canvas regardless of whether width, height, or canvas dimensions were provided. Now, padding and resizing only occur if the corresponding options are set. This change makes the code more flexible and prevents potential errors when certain parameters are not provided.
This commit is contained in:
parent
c6d800c010
commit
8fbbccfa21
11
index.php
11
index.php
@ -53,9 +53,14 @@ if(isSvg($imagecontent)) {
|
||||
$transparent = (new \Intervention\Image\Colors\Rgb\Color(0,0,0,0));
|
||||
// to finally create image instances
|
||||
$image = $manager
|
||||
->read($imagecontent)
|
||||
->pad($options['width'], $options['height'], $transparent)
|
||||
->resizeCanvas($options['canvaswidth'], $options['canvasheight'], $transparent);
|
||||
->read($imagecontent);
|
||||
|
||||
if(isset($options['width']) || isset($options['height'])) {
|
||||
$image = $image->pad($options['width'], $options['height'], $transparent);
|
||||
}
|
||||
if(isset($options['canvaswidth']) || isset($options['canvasheight'])) {
|
||||
$image = $image->resizeCanvas($options['canvaswidth'], $options['canvasheight'], $transparent);
|
||||
}
|
||||
|
||||
if (isset($options['fill'])) {
|
||||
$image = $image->blendTransparency($options['fill']);
|
||||
|
Loading…
Reference in New Issue
Block a user