image Convert Kohana Image Library to Yii

  1. Documentation
  2. Change Log

Provides methods for the dynamic manipulation of images. Various image formats such as JPEG, PNG, and GIF can be resized, cropped, rotated and sharpened.

All image manipulations are applied to a temporary image. Only the save() method is permanent, the temporary image being written to a specified image file.

Image manipulation methods can be chained efficiently. Recommended order: resize, crop, sharpen, quality and rotate or flip

此库提供方法动态的处理图片。支持对 JPEG,PNG 和 GIF 格式的图片进行调整大小,剪裁,旋转和锐化。

所有对图片的处理都会应用到一个临时图像上面,但只有 save() 方法是永久的,它会把临时图像写入指定的图像文件中。

图像处理方法也可以用“串连(chained)”方式。推荐顺序为:大小,剪裁,锐化,质量和旋转或翻转。

Resources

Documentation

Requirements
  • Yii 1.0 or above
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'),
        ),...
)

See the following code example:

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

Change Log

February 1, 2009
  • The use of Yii::import instead of require to load image driver
  • Change image driver filename
January 22, 2009
  • Initial release.
83 0
94 followers
26 093 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Others
Developed by: miles
Created on: Jan 22, 2009
Last updated: 14 years ago

Downloads

show all

Related Extensions