Let me join in this with a question:
You need
http://www.arch13.com/index.php?id=brewery&id2=12345
to turn into a "brewery" page with image number 12345?
Or are you trying to hide id2 from the url and just show id=brewery ?
EDIT: I think I get the fact that you want to simplify the URL to hide the paths, but it's ok to have both id= and id2= in the url.
So I suggest (as posted by you earlier):
http://www.arch13.com/index.php?id=brewery&id2=12345
The code should be something like this:
PHP Code:
//constant:
define('IMAGE_PATH', 'img/');
//VALIDATE THE INPUT BEFORE THIS.
$filename=$_REQUEST['id'].'_'.$_REQUEST['id2'].'.jpg' //turns index.php?id=brewery&id2=1 into brewery_1.jpg
$image_location=IMAGE_PATH.$filename (turns it into 'img/brewery_1.jpg')
Then you can proceed to check for file_exists, and enter it into your code.
And you should validate your code as people could try to access your complete filesystem by requesting stuff like id=../../etc/passwd
(Depending on system setup this might work).