How to Set Width on Imagine Framework
Learn how to use imagine image class. Use this to resize widen image and keep aspect ratio.
This is a tutorial on how to set width only on image. This is done with widen function. This is very useful when you want to size an image to a certain width and keep aspect ratio for the height.
$imagine = new \Imagine\Gd\Imagine(); $image = $imagine->open( $_FILES['file']['tmp_name'] ); $image->resize( // get original size and set width (widen) or height (heighten). // width or height will be set maintaining aspect ratio. $image->getSize()->widen( 700 ) ); $image->save( 'path/to/filename.jpg' );