[CONTROLLER][Attachment] Some attachments may not have dimensions

This commit is contained in:
Diogo Peralta Cordeiro 2021-08-18 22:12:27 +01:00
parent a383021992
commit f25759d60b
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0
1 changed files with 3 additions and 1 deletions

View File

@ -147,7 +147,9 @@ class Attachment extends Controller
throw new ClientException(_m('The requested thumbnail dimensions are not allowed'), 400); // 400 Bad Request
}
[$width, $height] = AttachmentThumbnail::predictScalingValues($attachment->getWidth(), $attachment->getHeight(), $width, $height, $crop);
if (!is_null($attachment->getWidth()) && !is_null($attachment->getHeight())) {
[$width, $height] = AttachmentThumbnail::predictScalingValues($attachment->getWidth(), $attachment->getHeight(), $width, $height, $crop);
}
$thumbnail = AttachmentThumbnail::getOrCreate(attachment: $attachment, width: $width, height: $height, crop: $crop);