arun-007's avatar

laravel image upload

https://image.intervention.io/v2

Help me with the image resizing without losing quality

0 likes
8 replies
Sinnbeck's avatar

Show the code you have that is currently loosing quality

arun-007's avatar

$thumbnailImage->resize(1920, 1080); $thumbnailImage->save($originalPath.$filename.'_'.$random_string.$value.'.'.$filetype, 80);

this also not working image is still blurred and stretched

SagorIslam's avatar

check the doc:

https://image.intervention.io/v2/api/save

and set quality

1 like
arun-007's avatar

@SagorIslam

$thumbnailImage->fit(1920, 1080); $thumbnailImage->save($originalPath.$filename.'_'.$random_string.$value.'.'.$filetype,90); That didn't work either

Snapey's avatar

@arun-007 you can't just blindly resize if A. the file is not that large, or B. The image is not in the correct ratio.

You can use. ->fit() to resize the image keeping aspect ratio but the image will always lose quality if it is not more than 1920x1080 to start with

1 like
arun-007's avatar
arun-007
OP
Best Answer
Level 1

@Snapey thanks, I resolved it this is perfectly working

$value = '150X150'; Image::make($originalImage)->fit(150, 150)->save($originalPath.$filename.''.$random_string.$value.'.'.$filetype); $value = '300X300'; Image::make($originalImage)->fit(300, 300)->save($originalPath.$filename.''.$random_string.$value.'.'.$filetype); $value = '1920X1080'; Image::make($originalImage)->fit(1920, 1080)->save($originalPath.$filename.''.$random_string.$value.'.'.$filetype);

Snapey's avatar

@arun-007 so glad you were able to solve it on your own

1 like

Please or to participate in this conversation.