| px | top | add code | search | signup | login | help |
<?php
header("Content-type: image/png");
$string = $_GET['label'];
$symbols=array('r','g','b');
for($i=0;$i<count($symbols);$i++) {
$this=$symbols[$i]; if(is_numeric($_GET[$this])) { $$this=$_GET[$this]; } else { $$this=0; }
}
$symbols=array('tr','tg','tb');
for($i=0;$i<count($symbols);$i++) {
$this=$symbols[$i]; if(is_numeric($_GET[$this])) { $$this=$_GET[$this]; } else { $$this="255"; }
}
if(isset($_GET['font'])) { $font = $_GET['font']; } else { $font="2"; }
$len=strlen($string);
$text_width = imagefontwidth($font);
$text_height = imagefontwidth($font);
$im = imagecreate (($len*$text_width)+10, $text_height+10); /* Create a blank image */
$bgc = imagecolorallocate ($im, $r, $g, $b);
$tc = imagecolorallocate ($im, $tr, $tg, $tb);
imagefilledrectangle ($im, 0, 0, 150, 30, $bgc);
imagestring ($im, $font, 5, 0, "$string", $tc);
imagepng($im);
imagedestroy($im);
?>
Comments or questions?
PX is running PHP 5.2.11
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.