Custom Page

Support, Snippets & Projects

Moderators: Moderator, Global Moderator

Post Reply
radar
Newbie
Newbie
Posts: 0
Joined: Thu Jun 17, 2004 12:37 am

Custom Page

Post by radar »

<?
&#036;one = rand(1,26);
&#036;two = rand(1,26);
&#036;string[1] = substr(md5(&#036;one),0,&#036;two);
&#036;string[2] = substr(md5(&#036;two),0,&#036;one);
&#036;string[1]['len'] = strlen(&#036;string[1]);
&#036;string[2]['len'] = strlen(&#036;string[2]);
&#036;im = imagecreatetruecolor(500,100);
&#036;background_color = imagecolorallocate(&#036;im, 255, 255, 255);
&#036;blk = imagecolorallocate(&#036;im, 255, 0, 0);
&#036;blk2 = imagecolorallocate(&#036;im, 0, 0, 255);
&#036;font['size'] = '8';
&#036;font['face'] = 'tahoma';
imagettftext(&#036;im,8,0,5,14,&#036;blk,'fonts/' . &#036;font['face'] . '.ttf',&#036;string[1]);
&#036;x = 5 + &#036;string[1][len]*&#036;font['size'];
imagettftext(&#036;im,8,0,&#036;x,14,&#036;blk2,'fonts/' . &#036;font['face'] . '.ttf',&#036;string[2]);
imagepng(&#036;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?
Post Reply

Return to “PHP &amp; MySQL”