Yii 1.1: yiimagethumb

Image Thumbnailer

Creates thumbnails and caches them so you don't recreate every time a page loads.


Yii 1.1 or above


Save YiimageThumb.php to protected/components

Update protected/config/main.php

    .... REST OF COMPONENTS ....

How To Use

$image = Yii::app()->thumb->render(Yii::app()->basePath . '/../profiles/' . $model->image, array(
    'width' => '250',
        'height' => '250',
        'link' => 'true',
        'hint' => 'false',
        //'crop' => 'false',
        'sharpen' => 'true',
        'longside' => '255',
        // Any $htmlOptions that can be used in CHtml::image()
        'imgOptions' => array('class' => 'thumb_image'),
        'imgAlt' => 'Test',
echo $image;

Total 2 comments

#12959 report it
cfletcher1856 at 2013/04/23 10:26am
size or create?

It creates thumbnail file, it is hashed so it will not generate a new image for every request.

#12958 report it
Shahcheraghean at 2013/04/23 10:06am
size or create?

Dose it create a thumbnal file for image or just resize it in view render?

Leave a comment

Please to leave your comment.

Create extension
No downloadable files yet