CodeIgniter IMG – thumbnails

CodeIgniter library to generate high quality thumbnails

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

Features

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

Usage

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

$this->load->library('img');

In view you can use function with this parameters:

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

Parameters:

longside – width of longest side (pixel value),
shortside – width of 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

Documentation is located at https://github.com/slav123/CodeIgniter-Img/wiki

Installation

Just put img.php file in libraries path.

[button link=”https://github.com/slav123/CodeIgniter-Img” style=”large red rect” target=”_blank”]Download CodeIgniter IMG[/button]