The web server will then redirect the call to the script and pass the required image format to the script as a parameter. Whatever is loading the image is unaware that any PHP is invoved.
Code: Select all
#Banner image redirection to script
RewriteEngine On
RewriteRule ^banner.(gif|jpg|png)$ banner.php?format=$1 [NC,L]
RewriteRule ^(avatar[0-9]+).(gif|jpg|png)$ $1.php?format=$2 [NC,L]
Edit: I just remembered that I modded Ken's scripts slightly to enable the passing on the format parameter.
So in teh avatar.php script after the $DATA =, add the additional parameter handling...
Code: Select all
// Read data into array
$DATA = get_raw($SITE['hloc'] . $SITE['datafile'],' ');
// Has an output format paramter been passed to the script?
if (isset($_GET['format']) && $_GET['format'] !== '') {
$SITE['format'] = strtolower($_GET['format']);
}