forked from GNUsocial/gnu-social
[ATTACHMENTS] Ensure thumbnail dimensions are bounded and change way cropping is implemented
This commit is contained in:
@@ -147,6 +147,8 @@ 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);
|
||||
|
||||
$thumbnail = AttachmentThumbnail::getOrCreate(attachment: $attachment, width: $width, height: $height, crop: $crop);
|
||||
|
||||
$filename = $thumbnail->getFilename();
|
||||
|
||||
Reference in New Issue
Block a user