Yii image Processing database image-Kohana
This library provides methods to dynamically process images. Allows you to resize, crop, rotate, and sharpen JPEG, PNG, and GIF images.
All image processing will be applied to a temporary image, but only the save () method is permanent. it will write the temporary image into the specified image file.
The image processing method can also be chained. The recommended sequence is: size, cropping, sharpening, quality and rotation or flip.
This library provides methods to dynamically process images. Allows you to resize, crop, rotate, and sharpen JPEG, PNG, and GIF images.
All image processing will be applied to a temporary image, but only the save () method is permanent. it will write the temporary image into the specified image file.
The image processing method can also be chained. The recommended sequence is: size, cropping, sharpening, quality and rotation or flip.
Requirement
Yii 1.0 or later
Install
Use
The following is the configuration file code:
12345678910111213141516 |
'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 '),),...) |
See the following code example:
12345678 |
$ 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 = newImage ('images/test.jpg'); $ image-> resize (400,100)-> rotate (-45)-> quality (75) -> sharpen (20); $ image-> render (); |