Yii image Processing database image-Kohana

Source: Internet
Author: User
Tags imagemagick kohana
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
  • Decompress the package to protected/extensions.

  • Decompress the helpers folder to protected

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 ();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.