Add default width parameter to resizer
This commit is contained in:
parent
03b13733ff
commit
1aa76cb053
@ -0,0 +1,3 @@
|
||||
ROOT_DOMAIN=https://lewisdale.dev
|
||||
DB_NAME=image_resizer.db
|
||||
DEFAULT_WIDTH=600
|
@ -26,7 +26,7 @@ class Resizer
|
||||
}
|
||||
|
||||
// Fetch the image at the given URL
|
||||
$original_img = Image::fromUrl($_ENV['root_domain'] . $path);
|
||||
$original_img = Image::fromUrl($_ENV['ROOT_DOMAIN'] . $path);
|
||||
$converted = $this->createVariant($original_img, $params);
|
||||
|
||||
// Store the image in the database
|
||||
@ -44,9 +44,7 @@ class Resizer
|
||||
{
|
||||
$quality = $params->quality ?: -1;
|
||||
|
||||
if ($params->width) {
|
||||
$original->toWidth($params->width);
|
||||
}
|
||||
$original->toWidth($params->width ?? intval($_ENV["DEFAULT_WIDTH"]));
|
||||
|
||||
return $original->encode($quality);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user