CodeIgniter is quite mature framework to creating web application, the built in libraries and helper very helpful to creating most feature in web application, this post I want to create very basic image gallery using CodeIgniter, the the built in libraries that I used are File Uploading, Image Manipulation and Pagination, whereas the used helper is URL Helper, and here’s we go
First open the config.php in folder system/application/config/ and set the CodeIgniter base_url
$config['base_url'] = "http://localhost/ci_gallery/";
Next load the URL Helper in autoload.php in the same folder as above file
$autoload['helper'] = array('url');
Now create the image controller in file image.php inside folder system/application/controller and add this attribute inside the image class
private $data = array(
'dir' => array(
'original' => 'assets/uploads/original/',
'thumb' => 'assets/uploads/thumbs/'
),
'total' => 0,
'images' => array(),
'error' => ''
);