PX : code

Superimpose text over blank image by Marcus
Download this code


<?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 ($im0015030$bgc);
        
imagestring ($im$font50"$string"$tc);
        
imagepng($im);
        
imagedestroy($im);
?>

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.