Use fit() instead of resize().
http://image.intervention.io/api/fit
Edit: Never mind. I think I misread your question. If you don't want cropping, then don't use fit() and go with @spekkionu's suggestion.
Hi
I am using Image Intervention for the image adjustment before saving it, but i can't make it work to have them all same size but still with the same aspect ratio. How to achieve that? example is image will be save 500x500 but the image inside of it will be resize to fit inside the 500x500 without cropping and still with the same aspect ratio (portrait or landscape mode)
here is what i currently have for the image
$img->resize(500, 500)->save(Config::get('images.full_size') . $filename);
Ok, so you don't just want to resize the image you want to resize it and then pad it to be exactly 500x500.
What you need to do is create a 500x500 image with whatever background color you want to pad with then use the insert method to paste your resized image on top of it.
http://image.intervention.io/api/insert
// Resized image
$img->resize(500, 500, function ($constraint) {
$constraint->aspectRatio();
});
// Canvas image
$canvas = Image::canvas(500, 500);
$canvas->insert($img, 'center');
$canvas->save();
Please or to participate in this conversation.