![]() $image->scaleDown(width: 200) // 200 x 150 // scale down to fixed height $image = ( new ImageManager( 'gd'))->make( 'images/example.jpg') // 800 x 600 // scale down to fixed width Public Image::scaleDown(?int $width, ?int $height): ImageInterface $image->scale( 200, 100) // 200 x 150 Scaling images but do not exceed the original size Keep in mind that the resulting size my differ from the given arguments, because the aspect ratio will be maintained preferably. For this kind of modification you can simply use the methods scale() or scaleDown(). Often you want to resize an image but do not want to distort the original image aspect ratio. Public Image::scale(?int $width, ?int $height): ImageInterface Scaling Images Resizing Images Proportionally $image = $image->resizeDown( 2000, 100) // 800 x 100 // resize only image width to 200 pixel and do not exceed the origial width Public Image::resizeDown(?int $width, ?int $height): ImageInterface Resizing without exceeding the original size $image = ( new ImageManager( 'gd'))->make( 'images/example.jpg') Parameters NameĮxamples use Intervention\ Image\ ImageManager The method support named arguments to target just one axis for the modification. Use resizeDown() to change the size but do not exceed the original size of the image. The method resize() simply stretches the image to the desired size. Public Image::resize(?int $width, ?int $height): ImageInterface Padded resizing without exceeding the original size.Fitted resizing without exceeding the original size.Scaling images but do not exceed the original size.Resizing without exceeding the original size.Version 3 (alpha) Version 2 (stable) Resizing Images Setting new image sizes
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |