security image font change

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

security image font change

Post by itsmani1 »

Here is my very simple code for making security image, I am not happy with font style and size, Please help me so that i can change the font size and style

Code: Select all

 
<?PHP
    $str = str_shuffle('abcdefghijklmnopqrstuvwxyz0123456789');
    $substr = substr($str, 0, 6);
    $im = imagecreate(60, 25);
    // white background and blue text
    $bg = imagecolorallocate($im, 255, 255, 255);
    $textcolor = imagecolorallocate($im, 0, 0, 0);
    // write the string at the top left
    imagestring($im, 9, 2, 4, $substr, $textcolor);
    // output the image
    header("Content-type: image/png");
    imagepng($im);
?>
 
thank you

~pickle | Changed your code tags to php rather than text
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: security image font change

Post by Zoxive »

PHP Manual - imagestring() wrote: font
Can be 1, 2, 3, 4, 5 for built-in fonts in latin2 encoding (where higher numbers corresponding to larger fonts) or any of your own font identifiers registered with imageloadfont().
or use imagettftext().
Post Reply