[eluser]William90[/eluser]
When using this controller you have to spesify both function name and parameter. like images/view/dog.jpg. This is due to the fact that you cannot give parameters to the index member. Add the following in the routes file to make images/dog.jpg work:
Code:
$route['images/(:any)'] = "images/view/$1";
Also a updated version of the controller.
Code:
function view($image = NULL)
{
//Base URL
$url = 'http://localhost/code/system/application/views/images/';
$image = str_replace('_','.',$image);
$extention = substr(strrchr($image,'.'),1);
switch ($extention)
{
case 'jpg': $content = 'jpeg'; break;
default: $content = $extention;
}
$path = $url.$image;
if (!file_exists('system/application/views/images/'.$image))
$path = $url.'notfound.jpg';
header("Content-type: image/".$content);
include($path);
}