Click to See Complete Forum and Search --> : Replace Variable With Images


SD-Syndicate
03-05-2005, 09:31 PM
Hi all,

I just incorporated this script into my site to show members rankings as images, It maybe of some use to some other people so hope yous find it useful :)


<?php
// Replace $variable with your variable
$variable = "12745";

// Gets the variable number length
$variablelength=strlen($variable);

// Echos the number as a GIF
for ($i=0; $i<$variablelength; $i++){
$c=substr($variable,$i,1);
echo "<img src=../imgs/".$c.".gif> ";
}
?>

bubblenut
03-05-2005, 09:40 PM
I'm not sure how the rest of your system works but from as far as I can see there no garuntee the file actually exists. Prehapse sticking some kind of condition in that respect might tighten things up a little.