• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HTML Template and Its images

#11
[eluser]saidbakr[/eluser]
Its a great idea. Thank you.

#12
[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);
    }


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.