[MEDIA] Fixed wrong image cropping

This commit is contained in:
Miguel Dantas 2019-08-03 21:02:21 +01:00
parent 955d5a136f
commit 8b106dbc6c

View File

@ -345,7 +345,13 @@ class ImageFile extends MediaFile
$img = $img->orientate();
}
$img->crop($box['width'], $box['height'], $box['x'], $box['y']);
$img->fit($box['width'], $box['height'],
function ($constraint) {
if (common_config('attachments', 'upscale') !== true) {
$constraint->upsize(); // Prevent upscaling
}
}
);
// Ensure we save in the correct format and allow customization based on type
$type = $this->preferredType();