As leatherback mentioned above you may want to add the line:
echo "Ext = $ext<br>\n";
Add it right above the first if statement, that will show you what the value of $ext is.
Another quick suggestion that might make the code a little tidier (instead of a bunch of if statements)
$ext = substr($imagelink, -3, 3);
select ($ext) {
case 'jpg':
// insert echo here;
break; // don't forget the break or it will keep processing the rest of the lines
case 'swf':
// insert echo here;
break; // don't forget the break or it will keep processing the rest of the lines
default:
echo "Sorry, there was an error returning the Banner. Please refresh";
echo "ext: $ext<br />\n";
}
In the above example, you can easily add more 'extensions' easily and quickly. As well, if it comes across one that it doesn't understand (default🙂 it will kick back your error message and the extension that it is having problems understanding.
Hope this helps a little.