Pages

Sunday, June 9, 2013

Cakephp-using Timthumb in cakephp

Using TimThumb in cakephp

Timthumb library is used to generated required sized images on the fly..it produces images of required size which are stored in its cache as such page is loaded much faster...

Timthumb can be easily downloaded from

http://timthumb.googlecode.com/svn/trunk/timthumb.php

Download the file and place it in

/webroot/files/timthumb.php

create a folder called cache with permissions "777" under the same folder.

now use the following code to echo images via timthumb

 echo $this->Html->image('/files/timthumb.php?src='.WWW_ROOT.'/img/imgname.jpg&w=63&h=63');  


this will convert any size image to 63X63 on the fly...you see more options of this library to make a better use of the same.

1 comment:

  1. Hello

    Hope you are doing great
    we have used Timthumb but not display all images frontend

    we have add files this place /webroot/timthumb.php and created cache folder same position.we have change permission 777 to cache folder. but not display images .i am newbeies in cakephp please suggest me how can do it

    Thanks

    ReplyDelete