Image::widen
Resize current image proportionally to given width
2.9M Downloads / Month
Open Source MIT License
2.9M Downloads / Month
Open Source MIT License
public Intervention\Image\Image widen(integer $width, [Closure $callback])
Resizes the current image to new width, constraining aspect ratio. Pass an optional Closure callback as third parameter, to apply additional constraints like preventing possible upsizing.
The new width of the image
Closure callback defining constraint to prevent unwanted upsizing of the image. See examples below.
public Intervention\Image\Size upsize()
Keep image from being upsized.
Instance of Intervention\Image\Image
// resize image to new width
$img = Image::make('public/foo.jpg')->widen(300);
// resize image to new width but do not exceed original size
$img = Image::make('public/foo.jpg')->widen(300, function ($constraint) {
$constraint->upsize();
});