Php – How resize image with custom ratio using Intervention image manipulation library in laravel

image manipulationlaravelPHP

I want to resize an image with custom ratio (width:height)=(5:1)

so please give me some suggestions.

Best Answer

I think the best solution might be, to use fit() from the library.

Like this:

// open 4/3 image for example
$image = Image::make('foo.jpg');

// your desired ratio
$ratio = 16/9;

// resize
$image->fit($image->width(), intval($image->width() / $ratio));

It don't stretches the image.

Related Topic