Need Help, I want create an image access caching, example image at url
example.com/caching/m_images.jpg
if that image exists then show image, but if don’t exist, maybe with .htaccess script, to run image function at :
example.com/recaching/m_images.jpg
to create new image with custom size at caching folder, then access again the image url.
How to do this, or there is another better solution ??
Thanks.
ps
I already have little script htaccess to remove ‘index.php?’ from codeigniter url
RewriteEngine on RewriteCond $1 !^(index\.php|js|css|caching) RewriteRule ^(.*)$ index.php/$1 [L]
so the real url of function is:
example.com/index.php?recaching/m_images.jpg
How about:
the above “should” (i’ve not tested it) redirect any requested files inside the images folder (assuming you have an images folder) and passes the path to the route recaching.
You can then, using
file_exists,readfileandheaderwrite the file to the browser if it does not exist.i.e.