image extension thanks for replying...
Posted 30 January 2011 - 01:37 PM
I am newbie!
I prefer to use imageextension.
I have done:
* Extract image folder under protected/extensions
* Extract helpers folder under protected
The following code is the component registration in the config file:
// GD or ImageMagick
// ImageMagick setup path
but I do not know where to put these code:
$image = Yii::app()->image->load('images/test.jpg');
$image->save(); // or $image->save('images/small.jpg');
$image = new Image('images/test.jpg');
Anybody would help? where to put these code?
Posted 30 January 2011 - 03:10 PM
Posted 22 June 2013 - 11:42 AM
If you want to resize the image as soon as it is uploaded , then as uploading is handled in controller , you would put that in controller.
You can just give it a try by creating an empty view and post something like this:
$realpath=realpath(Yii::app()->request->baseurl); $url="/images/imagedatatype/"; $image = Yii::app()->image->load($realpath.$url.'1_New.gif'); $image->resize(100, 100)->rotate(-45)->quality(75)->sharpen(20); //echo var_dump($image); $image->save($realpath.$url.'1_New_thumb.gif');
Obviously take care of those $url and image names.
Btw, if you are using in windows -
Then it would work.