[ImageEncoder] Fix error when not providing a width and/or height

This commit is contained in:
Hugo Sales 2021-04-16 22:54:22 +00:00
parent e385a9ac29
commit 0c8c5a4b87
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
1 changed files with 3 additions and 5 deletions

View File

@ -46,13 +46,11 @@ class ImageThumbnail extends Controller
$max_width = Common::config('thumbnail', 'width');
$max_height = Common::config('thumbnail', 'height');
$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);
$crop = $this->bool('c') ?? false;
$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);
$crop = $this->bool('c') ?: false;
$thumbnail = AttachmentThumbnail::getOrCreate(attachment: $attachment, width: $width, height: $height, crop: $crop);
DB::persist($thumbnail);
DB::flush();
$filename = $thumbnail->getFilename();
$path = $thumbnail->getPath();