Yii Framework Forum: image extension - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

image extension thanks for replying... Rate Topic: -----

#1 User is offline   jumamidin 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 26-December 10

Posted 30 January 2011 - 01:37 PM

hi! everybody!

I am newbie!

I prefer to use imageextension.
I have done:

Installation ¶

* Extract image folder under protected/extensions
* Extract helpers folder under protected

Usage ¶

The following code is the component registration in the config file:

'import'=>array(
...
'application.helpers.*',
...
),


'components'=>array(
'image'=>array(
'class'=>'application.extensions.image.CImageComponent',
// GD or ImageMagick
'driver'=>'GD',
// ImageMagick setup path
'params'=>array('directory'=>'/opt/local/bin'),
),...
)




but I do not know where to put these code:

$image = Yii::app()->image->load('images/test.jpg');
$image->resize(400, 100)->rotate(-45)->quality(75)->sharpen(20);
$image->save(); // or $image->save('images/small.jpg');

or

Yii::import('application.extensions.image.Image');
$image = new Image('images/test.jpg');
$image->resize(400, 100)->rotate(-45)->quality(75)->sharpen(20);
$image->render();



Anybody would help? where to put these code?
0

#2 User is offline   Gustavo 

  • Master Member
  • Yii
  • Group: Moderators
  • Posts: 916
  • Joined: 27-July 10
  • Location:Curitiba - Brasil

Posted 30 January 2011 - 03:10 PM

in your controller probably, but you should know better...
--
Extensions:
translate modue - module to handle translations
multiActiveRecord - db selection in models
redisCache - redis cache component
mpCpanel - interact with cpanel api
mUploadify - use uploadify uploader in your application

Gustavo Salomé Silva
0

#3 User is offline   jumamidin 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 26-December 10

Posted 30 January 2011 - 04:22 PM

clearly, please...

I can not make it useful...

Thanks!
0

#4 User is offline   yashu 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 11-June 13

Posted 22 June 2013 - 11:42 AM

It really depends on your purpose,
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 -

change -
escapeshellcmd($this->dir.'convert'.$this->ext)

to
'"'.$this->dir.'convert'.$this->ext.'"'


Then it would work.

Thanks!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users