CodeIgniter IMG – thumbnails on the fly

CodeIgniter IMG – thumbnails on the fly
Page content

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 different, we are using core from Thumb, and some modification which gives more flexibility to work with it.

Features

  • thumbnails are generated “on the fly” no additional 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 these parameters:

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

Parameters:

longside – width of the 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.

Download CodeIgniter IMG