grab — Crop and resize combined
public Intervention\Image\Image grab(int $width, int $height)
Combine cropping and resizing to format image in a smart way. The method will find the best fitting aspect ratio of your given width and height on the current image automatically, cut it out and resize it to the given dimension.
The width the image will be resized to after cropping out the best fitting aspect ratio.
The height the image will be resized to after cropping out the best fitting aspect ratio.
Instance of Intervention\Image\Image
// open file a image resource $img = Image::make('public/foo.jpg'); // crop the best fitting 5:3 (600x360) ratio and resize to 600x360 pixel $img->grab(600, 360); // crop the best fitting 1:1 ratio (200x200) and resize to 200x200 pixel $img->grab(200);