Update (post editor): Only forceResize for featured image, other images follow back size
This commit is contained in:
@@ -32,11 +32,13 @@ public function index(Request $request)
|
||||
$originalWidth = $image->width();
|
||||
$originalHeight = $image->height();
|
||||
|
||||
// Resize/upscale the image to 1920x1080 maintaining the aspect ratio and cropping if needed
|
||||
$image->fit(1920, 1080, function ($constraint) {
|
||||
$constraint->upsize();
|
||||
$constraint->aspectRatio();
|
||||
});
|
||||
if ($request->input('forceSize')) {
|
||||
// Resize/upscale the image to 1920x1080 maintaining the aspect ratio and cropping if needed
|
||||
$image->fit(1920, 1080, function ($constraint) {
|
||||
$constraint->upsize();
|
||||
$constraint->aspectRatio();
|
||||
});
|
||||
}
|
||||
|
||||
// Compress the image to reduce file size to 50%
|
||||
$image->encode('jpg', 50);
|
||||
|
||||
Reference in New Issue
Block a user