Update (post editor): Only forceResize for featured image, other images follow back size

This commit is contained in:
2023-07-31 01:49:20 +08:00
parent 9ed9671f09
commit 2a802ccd44
21 changed files with 30 additions and 27 deletions

View File

@@ -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);