Welcome Guest, Not a member yet? Register   Sign In
Images Library - intercept "/images/"
#1

[eluser]Innovatics[/eluser]
Hey guys,

I'm currently developing an Images Library. I want to resize Images dynamically on calling

http://localhost/<b>images</b>/image.jpg

I don't want to use a controller, I would like to use a Library by intercepting the "/images" path - simply because I only want to copy this file from project to project.

That works fine if I include the library into autoload, but if there is no controller or function, I get 404, without calling the Images constructor. Do have an idea without changing other files?

Code:
&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Images {

    function Images()
    {
        $CI =& get_instance();

        if ($CI->uri->segment(1) == 'images')
            die('Show Picture');
    }

}


Regards,
Christian
#2

[eluser]Ian Jones[/eluser]
Have you investigated using routes?

You can intercept any uri call and direct it to a custom controller




Theme © iAndrew 2016 - Forum software by © MyBB