Hello community, I have a web site hosted by third party company which offers me cpanel to control my site. I have several jpg/bmp files hosted there which my users do a hot link and display the images in their sites. I was wondering if would be possible to run a php script when apaches receives a request to serve a image. It would be like a trigger everytime a image request is sent to my server. Any ideia in how I can acomplish this will be much appreciated. Thank you very much. Rgds Mauver
You can use mod_rewrite to have requests for images go to your script behind the scenes, then have the script work with "$_SERVER['REQUEST_URI'] which should refer to the image requested to send the headers for the image and read the image out to the browser.
Thank you Joebert ! Just one quick question, do I need to configure Apache for mod_rewrite ? I mean, is it something that only the server administrators can do or I can do it myself by using cpanel/php scripts ? Sorry for if the answer is so obvious, I am really a newbye on this Kind regards, Mauver
If Apache is installed, chances are mod_rewrite will be there too. I don't think I've ever seen a modern Apache-based host that doesn't have mod_rewrite available. If it's not there though, an Administrator is the only one who can install it.