change layout and fontsize in verification box

More
10 years 3 months ago #13718 by Vandepaar
Is it possible to change the picture, layout and fontsize of the verification box on my guestbook ( www.kinderthuisverplegingkempen.be ) ?

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

More
10 years 3 months ago #13719 by Pete
Hello Vandepaar,

Yes, it is possible. You can replace the verification image files here:

/images/back1.jpg
/images/back2.jpg
/images/back3.jpg
/images/back4.jpg
/images/back5.jpg

Simply replace each of these images with an image of your chosing. As for the font size and layout, it is controlled in the file "random.php"
Code:
// Make text color blak $textColor = imagecolorallocate ($image, 0, 0, 0); //put the code onto the background imagestring ($image, 5, 5, 8, $rand, $textColor);

You can change the size by changing the parameters of the "imagestrign" function. You can read more about this function here:

www.php.net/manual/en/function.imagestring.php

Thanks,
Pete

DigiOz Webmaster
www.digioz.com

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

More
10 years 3 months ago #13720 by Vandepaar
Thanks Pete for your quick reply. When I change the first 5 to for example 10 the font will not change. I already resized the image in Paint but then is the fontsize to small :-( . Is it also possible to align on middle center of the verification box ?

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

More
10 years 3 months ago - 10 years 3 months ago #13721 by Pete
Actually "5" is the limit for the function "imagestring". If you need bigger font than that you should use the "imagettftext":

www.php.net/imagettftext

The following example on that page demonstrates it well:
Code:
<?php // Set the content-type header('Content-Type: image/png'); // Create the image $im = imagecreatetruecolor(400, 30); // Create some colors $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 399, 29, $white); // The text to draw $text = 'Testing...'; // Replace path by your own font path $font = 'arial.ttf'; // Add some shadow to the text imagettftext($im, 20, 0, 11, 21, $grey, $font, $text); // Add the text imagettftext($im, 20, 0, 10, 20, $black, $font, $text); // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im); imagedestroy($im); ?>

Thanks,
Pete

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

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

More
10 years 3 months ago #13722 by Vandepaar
Pete, i'll tried it with the code "imagettftext" and put the font in the dir images. Now i am not be able to see the text in the verification images. Could you please help me ?

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

More
10 years 3 months ago #13723 by Pete
Can you post the exact code that you have in place? To do that, please copy and paste the entire content of your random.php file here inside a code block.

Thanks,
Pete

DigiOz Webmaster
www.digioz.com

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

Time to create page: 0.131 seconds
Powered by Kunena Forum