note 91180 added to function.imagecreatetruecolor

From: Date: Thu, 28 May 2009 21:07:20 +0000
Subject: note 91180 added to function.imagecreatetruecolor
Groups: php.notes 
Request: Send a blank email to php-notes+get-156125@lists.php.net to get a copy of this message
I put this together - combining two of the examples and then generated the text dynamically. but, with this set up, i was able to get the transparent background working as well. <?php // Set the content-type header('Content-type: image/png'); // Create the image $im = imagecreatetruecolor(175, 15); imagesavealpha($im, true); // 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, 150, 25, $black); $trans_colour = imagecolorallocatealpha($im, 0, 0, 0, 127); imagefill($im, 0, 0, $trans_colour); // The text to draw $text = $_GET['text']; // Replace path by your own font path $font = 'catriel regular.ttf'; // Add some shadow to the text imagettftext($im, 9, 0, 13, 16, $black, $font, $text); // Add the text imagettftext($im, 9, 0, 12, 15, $white, $font, $text); // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im); imagedestroy($im); ?> ---- Server IP: 209.41.74.194 Probable Submitter: 38.96.192.33 ---- Manual Page -- http://www.php.net/manual/en/function.imagecreatetruecolor.php Edit -- https://master.php.net/note/edit/91180 Del: integrated -- https://master.php.net/note/delete/91180/integrated Del: useless -- https://master.php.net/note/delete/91180/useless Del: bad code -- https://master.php.net/note/delete/91180/bad+code Del: spam -- https://master.php.net/note/delete/91180/spam Del: non-english -- https://master.php.net/note/delete/91180/non-english Del: in docs -- https://master.php.net/note/delete/91180/in+docs Del: other reasons-- https://master.php.net/note/delete/91180 Reject -- https://master.php.net/note/reject/91180 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#156125) next »