Welcome to Dream.In.Code
Become a PHP Expert!

Join 136,905 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,740 people online right now. Registration is fast and FREE... Join Now!




How can I change the font size of imagestring?

 
Reply to this topicStart new topic

How can I change the font size of imagestring?

Enlormn
12 Mar, 2008 - 10:04 PM
Post #1

New D.I.C Head
*

Joined: 26 Feb, 2008
Posts: 7


My Contributions
I have the following code so far as I build a custom CAPTCHA thing for my site (if it's not right let me struggle, it's how I learn, seriously) my issue though as far as I know so far is that the CAPTCHA text is too small and I want to make it bigger.
CODE
<?php session_start();
$imgWidth=110;
$imgHeight=50;
$image=imagecreate($imgWidth,$imgHeight);
$colorWhite=imagecolorallocate($image,255,255,255);
$colorRed=imagecolorallocate($image,255,0,0);
$colorBlack=imagecolorallocate($image,0,0,0);
for($i=0;$i<13;$i++){
    imageline($image,$i*10,0,$i*10,50,$colorBlack);
    imageline($image,0,$i*5,110,$i*5,$colorBlack);
}
for($i=0;$i<26;$i++){
    $x1 = rand(0,109);
    $x2 = rand(1,110);
    $y1 = rand(0,49);
    $y2 = rand(1,50);
    imageline($image,$x1,$y1,$x2,$y2,$colorBlack);
}
$rnum = rand(0,9999);
$pattern = "abcdefghijklmnopqrstuvwxyz";
$pattern2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$key = '';
for($i=0;$i<4;$i++){
    $key .= $pattern{rand(0,25)};
}
$key2 = '';
for($i=0;$i<4;$i++){
    $key2 .= $pattern2{rand(0,25)};
}
$string = $rnum.$key.$key2;
imagestring($image,3,1,15,$string,$colorRed);
header("Content-type: image/png");
imagepng($image);
imagedestroy($image);?>

If anyone has questions as to how any part works/what any part does feel free to ask and learn.
User is offlineProfile CardPM
+Quote Post

MitkOK
RE: How Can I Change The Font Size Of Imagestring?
13 Mar, 2008 - 01:00 AM
Post #2

D.I.C Regular
Group Icon

Joined: 9 Aug, 2007
Posts: 314



Thanked: 12 times
Dream Kudos: 250
My Contributions
QUOTE
bool imagestring ( resource $image , int $font , int $x , int $y , string $string , int $color )


QUOTE
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().


This post has been edited by MitkOK: 13 Mar, 2008 - 01:01 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 09:46PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month