Yii 1.1: image-helper

Image helper for thumbnails
6 followers

This is a helper for creating and caching thumbnails. Based on PHPThumb, The benefit over the image component ported from kohana is that it allows more resizing methods (like adaptive resize.

Resources

Documentation

Requirements

  • Yii 1.0 or above
  • The directory of the image needs to be writable... it will create a .tbm directory with all thumbnails for caching.

Installation

  • Extract the release file under protected/

Usage

See the following code example, it defaults to adaptive resize:

<?php echo Yii::app()->request->baseUrl.ImageHelper::thumb(600,800,$img, array('method' => 'resize'));?>

Default is:

<?php echo Yii::app()->request->baseUrl.ImageHelper::thumb(600,800,$img, array('method' => 'adaptiveResize'));?>

You can use the 3rd parameter for all options of PHP Thumb look on github for the documentation.

github.com/masterexploder/PHPThumb/

Change Log

August 15, 2010

  • Initial release.

Total 6 comments

#10760 report it
luc at 2012/11/21 04:23pm
good extension

thank you

#5819 report it
Maksold at 2011/11/16 08:22am
Resize small image to big

Why when I load small image for example 15x15, it changed at at 600x600. How make small pictures haven't changed?

Yii::app()->image->load($image)->resize(800, 600)->save();
#2673 report it
ianaré at 2011/01/26 12:19pm
Lack of options

Works as advertised but the lack of options means the class needs to be modified directly.

Also, 'ExceptionClass' needs to be renamed to 'CException'.

#2487 report it
szako at 2011/01/09 06:56pm
Thanks

Thanks, implemented!

#76 report it
retomi at 2010/09/22 06:03am
Thanks

Nice

#139 report it
retomi at 2010/08/29 12:14pm
Thanks

Nice work!!

Leave a comment

Please to leave your comment.

Create extension
  • Yii Version: 1.1
  • License: New BSD License
  • Developed by: mech7
  • Category: Others
  • Votes: +8 / -2
  • Downloaded: 2,426 times
  • Created on: Aug 15, 2010
  • Last updated: Aug 17, 2010