[ImageEncoder] Fix error when not providing a width and/or height
This commit is contained in:
parent
e385a9ac29
commit
0c8c5a4b87
@ -46,13 +46,11 @@ class ImageThumbnail extends Controller
|
|||||||
|
|
||||||
$max_width = Common::config('thumbnail', 'width');
|
$max_width = Common::config('thumbnail', 'width');
|
||||||
$max_height = Common::config('thumbnail', 'height');
|
$max_height = Common::config('thumbnail', 'height');
|
||||||
$width = Common::clamp($this->int('w') ?? $max_width, min: 0, max: $max_width);
|
$width = Common::clamp($this->int('w') ?: $max_width, min: 0, max: $max_width);
|
||||||
$height = Common::clamp($this->int('h') ?? $max_height, min: 0, max: $max_height);
|
$height = Common::clamp($this->int('h') ?: $max_height, min: 0, max: $max_height);
|
||||||
$crop = $this->bool('c') ?? false;
|
$crop = $this->bool('c') ?: false;
|
||||||
|
|
||||||
$thumbnail = AttachmentThumbnail::getOrCreate(attachment: $attachment, width: $width, height: $height, crop: $crop);
|
$thumbnail = AttachmentThumbnail::getOrCreate(attachment: $attachment, width: $width, height: $height, crop: $crop);
|
||||||
DB::persist($thumbnail);
|
|
||||||
DB::flush();
|
|
||||||
|
|
||||||
$filename = $thumbnail->getFilename();
|
$filename = $thumbnail->getFilename();
|
||||||
$path = $thumbnail->getPath();
|
$path = $thumbnail->getPath();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user