Welcome Guest, Not a member yet? Register   Sign In
HTML Template and Its images

Its a great idea. Thank you.

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:

$route['images/(:any)'] = "images/view/$1";

Also a updated version of the controller.
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);

Theme © iAndrew 2016 - Forum software by © MyBB