Forum:Way for template to run-through all extensions

I'm wondering if it's possible to make a template run-through all file extensions (i.e.,  , etc.) automatically, to conjure up the image.

For example, if this is the template:



how do I make is so that, just by inputting the file's name (parameter ), the template matches it with its correct extension to bring it up? How do I format the second parameter?

I'm also wondering how to format the template so that, if no file by that name exists, it does not display a dead link (such as ). Thanks. A .o. N 21:21, March 14, 2011 (UTC)


 * You'd want it to check with an (?) parser for each file extension. So, if it finds the file under .png, display that; else if it finds it under .jpg, display that; else .gif, etc. Once you've run through all of them, the last else should be what you want it to display if it doesn't find the picture.


 * OK, thanks, I'll try that. A .o. N  22:07, March 14, 2011 (UTC)


 * OK, I got the template down sort of. Here's what it looks like so far:

I just need the template own it's own to change interchangeably between the different types of file extensions there are. That means replacing the  with something, I don't know. Or maybe there's another way? A .o. N 00:23, March 15, 2011 (UTC)