We are going to deploy the new yiiframework.com website on March 23, 2018 from 8:00 to 12:00 UTC.
Website and Yii documentation will not be available in this time frame. Check the news for more details.

Yii 1.1: ephpthumb

a lightweight wrapper for the phpThumb library

This is a lightweight extension for the well known phpThumb library. There are a lot of extensions out there providing a lot more functionality but they can be total overkill for just creating some thumbnails and saving them to disk. If you just want a simple wrapper for phpThumb then this extension is the right one.


Yii 1.1.x


In your main.php

    'options'=>array(optional phpThumb specific options are added here)

For more information visit the phpThumb documentation.


Total 7 comments

#18969 report it
vishun at 2015/02/14 09:10pm

It works well.Thanks

#12344 report it
grod at 2013/03/14 10:58pm
Optimize adaptiveResize funtion with adaptiveResizePercent

If you are using the adaptiveResize, funcion as the documentation says, images are always cropped from the center.

If you wanna crop from the top/bottom=portrait left/right=landscape, you can use percentages with the adaptiveResizePercent function by sending a third parameter... how ever the creator of this extension didnt included the already available adaptiveResizePercent function. So add it to the EThumbnail.php file:

     * Resizes the image to the given dimensions as close as possible and from a desired x/y percent coordinate,
     * then crops it from the specified percent
     * Portrait images: 1=top, 50=center, 100=bottom
     * Landscape images: 1=left, 50=center, 100=right
     * @param integer $width the width to crop the image to.
     * @param integer $height the height to crop the image to.
     * @param integer $percent the percent to determine the crop x/y coordinates.
     * @return EThumbnail
    public function adaptiveResizePercent($width,$height,$percent=50)
            return $this;
#11222 report it
Laret at 2012/12/28 01:07pm
Polish version
#10712 report it
Nathan at 2012/11/18 09:36am

It'd be to detect if a thumbnail already exists in a cache

#9382 report it
jinmmd at 2012/08/08 01:40am
Nice work!

Exactly what I needed. Thank you! Been using CThumb before, but for simple thumbnails creation phpThumb is so much better.

#6676 report it
Mariusz W. at 2012/01/27 12:42pm
If you don't want to put it in main.php
$thumb=new EPhpThumb();
$thumb->init(); //this is needed
//chain functions
#6659 report it
sidewinder at 2012/01/26 02:24am
Good job

Exactly what I needed. Thank you! Been using WideImage before, but for simple thumbnails creation phpThumb is so much better.

Leave a comment

Please to leave your comment.

Create extension