Page 1 of 1

Custom Page

Posted: Sun Aug 28, 2005 6:33 am
by radar
<?
$one = rand(1,26);
$two = rand(1,26);
$string[1] = substr(md5($one),0,$two);
$string[2] = substr(md5($two),0,$one);
$string[1]['len'] = strlen($string[1]);
$string[2]['len'] = strlen($string[2]);
$im = imagecreatetruecolor(500,100);
$background_color = imagecolorallocate($im, 255, 255, 255);
$blk = imagecolorallocate($im, 255, 0, 0);
$blk2 = imagecolorallocate($im, 0, 0, 255);
$font['size'] = '8';
$font['face'] = 'tahoma';
imagettftext($im,8,0,5,14,$blk,'fonts/' . $font['face'] . '.ttf',$string[1]);
$x = 5 + $string[1][len]*$font['size'];
imagettftext($im,8,0,$x,14,$blk2,'fonts/' . $font['face'] . '.ttf',$string[2]);
imagepng($im,"file.png");
echo "<img src='file.png'>";
?>


The above is the code to make an image and put two elements in there, a red one and a blue one. Basically what I want it to do is to add 10 px spacing between the two elements. Is there any easy way to do it?