Vertification code

More
17 years 7 months ago #259 by DregNET
Vertification code was created by DregNET
Tnx for an exelent code

But i wold like to change the code size in the validation feald
Becose some old people cant read it

Is this possible and then how ?

Im the man

Please Log in or Create an account to join the conversation.

More
17 years 7 months ago #261 by Pete
Replied by Pete on topic Vertification code
Hello,

Yes, it is possible to change the font. Please do the following:

1) Open the file "random.php" in notepad.
2) Find the line 23 which is:
Code:
imagestring ($image, 5, 5, 8, $rand, $textColor);

Here is the description for that function:
Code:
bool imagestring ( resource image, int font, int x, int y, string s, int col )

In other words the first 5 sets the font size, the second integer sets the horizontal pixel distance and the third integer represents the vertical pixel distance from the edge of the images.

Simply change the first intger value from 5 to whatever font size you need.

DigiOz Webmaster
www.digioz.com

Please Log in or Create an account to join the conversation.

More
14 years 3 months ago #1399 by Irma
Replied by Irma on topic Vertification code
Hi,
I have tried this options but how high I make the font size, from 5 to 45, it doesn't work in my guest book!
Am I doing somthing wrong here?

Irma

Please Log in or Create an account to join the conversation.

More
14 years 3 months ago #1400 by Pete
Replied by Pete on topic Vertification code
Can you post the exact code you are using (exact values within the function call)?

Pete

DigiOz Webmaster
www.digioz.com

Please Log in or Create an account to join the conversation.

More
14 years 3 months ago #1401 by Irma
Replied by Irma on topic Vertification code
hi Pete,

lines
#22: //put the code onto the background
#23: imagestring ($image, 5, 5, 8, $rand, $textColor);

and here I change the first 5 into .......what ever figure and nothing happens.

Irma

Please Log in or Create an account to join the conversation.

More
14 years 3 months ago - 10 years 8 months ago #1405 by Pete
Replied by Pete on topic Vertification code
The largest size limit for "imagestring" function is 5. For larger size font, you need to use a different function called "imagettftext":
Code:
$font = 'C:\Inetpub\wwwroot\guestbook\fonts\arial.ttf'; imagettftext($image, 24, 0, 30, 50, $textColor, $font, $rand);

Replace the original line with the above two lines, where 'C:\Inetpub\wwwroot\guestbook\' is your guestbook installation directory. Inside that directory, create a folder called "fonts" and place the arial.ttf font file inside it. If all goes well, here is what you should see:





You will also have to resize all background images to a width of 160 pixels to accomplish. I am attaching a complete zip file with all modifications included for you below:


File Attachment:

File Name: guestbook.zip
File Size:530 KB



You can see the PHP Manual for more information on this function if needed (which you shouldn't).

Pete

DigiOz Webmaster
www.digioz.com
Attachments:
Last edit: 10 years 8 months ago by Pete.

Please Log in or Create an account to join the conversation.

Time to create page: 0.126 seconds
Powered by Kunena Forum