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.
Features
- 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
Usage
You need to upload a file img.php
into directory: application/libraries
In controller, you need to load library:
$this->load->library('img');
In the view you can use a 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 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
Documentation is located at https://github.com/slav123/CodeIgniter-Img/wiki
Installation
Just put img.php
file in libraries path.