security image font change

Discussion in 'PHP' started by dizyn, Jan 30, 2008.

  1. #1
    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
    	session_start();
    	$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);
    Code (markup):
    thank you
     
    dizyn, Jan 30, 2008 IP
  2. frankcow

    frankcow Well-Known Member

    Messages:
    4,859
    Likes Received:
    265
    Best Answers:
    0
    Trophy Points:
    180
    #2
    I'm pretty sure you can load a .ttf file on the server side. Check out Peter's anti-spam plugin for wordpress, he does it in that code
     
    frankcow, Jan 30, 2008 IP
  3. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
  4. maroc

    maroc Peon

    Messages:
    33
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    maroc, Jan 30, 2008 IP