CodeIgniter IMG – thumbnails

CodeIgniter IMG – thumbnails
Page content

CodeIgniter library to generate high-quality thumbnails

A library is based on excellent * Smarty plugin “Thumb” * created in 2005 by Christoph Erdmann. This version is a little bit different, we are using the core from Thumb, and some modification which gives more flexibility to work with it.


  • thumbnails are generated “on the fly” no additional actions required,
  • cache for generated thumbnails,
  • a clear structure for generated thumbnails,
  • thumbnails sharpening function,
  • cropping function,
  • fill space function


You need to upload a file img.php into directory: application/libraries In controller, you need to load library:


In the view you can use a function with this parameters:

echo $this->img->rimg($filename, array('longside' => 745, 'alt' => 'alt text')


  • longside – width of longest side (pixel value),
  • shortside – width of a shorter side
  • crop – cropping (true/false)
  • width – fixed width (with this parameter you need also set height)
  • height – height (with this parameter you need to also set height)
  • sharpen – sharp image after scale
  • nocache – rewrite existing file in the cache


Documentation is located at


Just put img.php file in libraries path.

Download CodeIgniter IMG