You could also do this: have the script "read" the directory name, and choose an image depending on whether or not it matches a certain number. $PHP_SELF tells the script the name of the subdirectory it is in, as well as the filename of the script. Let's say you are at www.you.com/dir2/index.php.
// find out if the directory is "dir2"
$find = "dir2";
if(strstr($PHP_SELF,$find))
// if it is, set this image:
{ $img="dir2.jpg"; }
Since you're at www.you.com/dir2/index.php, $PHP_SELF="/dir2/index.php". the strstr() function looks at the string "/dir2/index.php" and checks if it contains the substring "dir2" (which you set as $find). Since it does contain the substring, $img is set to "dir2.jpg".
Hope that helps,
Steph