change layout and fontsize in verification box

More
10 years 3 months ago - 10 years 3 months ago #13724 by Vandepaar
Code:
<?php //start session session_start(); //define your string $string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; //generate the code $rand = substr(0, 5); //put the md5 hash of the code into a session $_SESSION['image_random_value'] = md5($rand); // choose background image $bgNum = rand(1, 5); $image = imagecreatefromjpeg("images/back$bgNum.jpg"); // Make text color blak $textColor = imagecolorallocate ($image, 0, 0, 0); // Replace path by your own font path $font = ("images/arial.ttf"); //put the code onto the background //imagestring ($image, 5, 5, 8, $rand, $textColor); imagettftext($image, 12, 0, 5, 8, $textcolor, $font, $rand); //send headers // Date in the past header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // always modified header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // HTTP/1.1 header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); // HTTP/1.0 header("Pragma: no-cache"); // send the content type header so the image is displayed as a jpeg header('Content-type: image/jpeg'); // send the image to the browser imagejpeg($image); // destroy the image imagedestroy($image); ?>
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 - 10 years 3 months ago #13725 by Pete
Here is the modified code:

Code:
<?php //start session session_start(); //define your string $string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; //generate the code $rand = substr(str_shuffle($string), 0, 5); //put the md5 hash of the code into a session $_SESSION['image_random_value'] = md5($rand); // choose background image $bgNum = rand(1, 5); $image = imagecreatefromjpeg("images/back$bgNum.jpg"); // Make text color blak $white = imagecolorallocate($image, 255, 255, 255); $grey = imagecolorallocate($image, 128, 128, 128); $black = imagecolorallocate($image, 0, 0, 0); // select font $font = 'fonts/ASansrounded.ttf'; // Add some shadow to the text imagettftext($image, 28, 0, 8, 42, $grey, $font, $rand); // Add the text imagettftext($image, 26, 0, 9, 42, $black, $font, $rand); //send headers // Date in the past header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // always modified header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // HTTP/1.1 header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); // HTTP/1.0 header("Pragma: no-cache"); // send the content type header so the image is displayed as a jpeg header('Content-type: image/jpeg'); // send the image to the browser imagejpeg($image); // destroy the image imagedestroy($image); ?>


And here is how the result looks like:





I used the font "ASansrounded.ttf", but you obviously don't have to. If you do want to use the same font, you can download it from here:


www.fontspace.com/download/12477/cea39dd...vel-sans-rounded.zip


Lastly, if you need them, here are the enlarged background images:


File Attachment:

File Name: backgrounds.zip
File Size:27 KB



Thanks,
Pete

DigiOz Webmaster
www.digioz.com
Attachments:
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 #13726 by Pete
By the way, I noticed that you have removed the DigiOz Copyright from your guestbook. Part of the term of using the guestbook requires for you to give credit to the author of the guestbook. To do that, you can either leave the copyight in place, or place a link to a page on your site on the guestbook footer giving credit to us for developing it.

Thanks,
Pete

DigiOz Webmaster
www.digioz.com

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

Time to create page: 0.122 seconds
Powered by Kunena Forum