I have a redirect setup that looks for an image in a directory and if it does not exist, it will redirect to a php file that resizes an image and saves it to that directory. I got it to work great. Problem now is that I need to find a good way to redirect it if the image that was written is 4 hours old. I looked into Mod_expires but could not find a way to redirect to my php image resizer when the image is 4 hours old.
I know I could do this in PHP but the whole point was to reduce the server load by using apache instead of PHP. The site I'm working on gets several thousand viewers daily so I really need to efficiently cache the resized images. Here's an example of what I'm doing...
- Browser requests "http://images.mydomain.com/image/1234_01_thumb.jpg"
- Apache Checks if "http://images.mydomain.com/image/1234_01_thumb.jpg" exists
- If it does not exist, redirect to to "/image/resize_image.php" and generate a thumbnail in "/images/" folder
Now that I got that working how do I get it to redirect to "/image/resize_image.php" when the "1234_01_thumb.jpg" gets x hours old? At some point someone is going to have to update that photo especially if they uploaded the wrong one so it can't be permanent.
Please help. Thanks in advance!