widen — Resize image proportionally to given width
Description
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.
Parameters
width
The new width of the image
callback (optional)
Closure callback defining constraint to prevent unwanted upsizing of the image. See examples below.
upsize
public Intervention\Image\Size upsize()
Keep image from being upsized.
Return Values
Instance of Intervention\Image\Image
Examples
// 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();
});
See also
当前内容版权归 intervention 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 intervention .