I would like to know the best way to re size image , keep width and height from 1000 KB to 500 KB or 600 KB.
i tried some extension ,by passing same size into param of this extension but didn’t work well .
Any ideas ? plz provide me with info about it
You can use http://phpthumb.gxdlabs.com/ library (there must be an extension for this in Yii repository).
Before "resizing" an image, use getimagesize() to get the image width/height and use the size when accessing the thumb library, something like:
$options = array('resizeUp' => true, 'jpegQuality' => 60);
$thumb = PhpThumbFactory::create('/path/to/image.jpg', $options);
catch (Exception $e)
// handle error here however you'd like
The only way to shrink an image size is by lowering the quality of that image.
If you have PNG images, save them as jpeg first, then lower down their quality using the above method.
Here is some reference: