For example, if I have a file http://site.com/images/bird.jpg
When I go http://site.com/images/bird-200px-width.jpg
the server will say "file not found".
When the server determines the file is not found, is there a way to check the /images/ directory to see if an image with the first part of the title ("bird.jpg"), and if it exists, automatically resize and generate an image with the requested filename instead of saying "file not found"?
Use mod_rewrite (specifically RedirectCond
[twice]) to detect the absence of the thumbnail and rewrite to a script that generates and outputs the image.
Yes. As you asked a theoretical question, my answer will be theoretical too. Hope it's useful to you:
bird(.*)
.jpg where (.*)
is your wildcard)