note 76407 added to function.imagecolortransparent

From: Date: Fri, 13 Jul 2007 16:20:42 +0000
Subject: note 76407 added to function.imagecolortransparent
Groups: php.notes 
Request: Send a blank email to php-notes+get-128442@lists.php.net to get a copy of this message
This script creates transparency for a unspecific RBG color for an already created PNG image. It also includes script of overlay text that does not get ruined in the process. <?php header("Content-type: image/png"); $image = imagecreatetruecolor(250, 250); $string = $_GET['text']; $im = imagecreatefrompng("dynIcon.png"); $img = imagecreatetruecolor(16,16); $orange = imagecolorallocate($im, 220, 210, 60); $bg_color = imagecolorat($im,1,1); $px = (imagesx($im) - 3 * strlen($string)) / 2; imagecolortransparent($im, $bg_color); imagestring($im, 3, $px, 5, $string, $orange); imagepng($im); imagedestroy($im); ?> Use $bg_color = imagecolorat($im,1,1); for instance, if you made the transparent color in photoshop by clearing out all the color leaving you with the checkered background showing you it's empty. ---- Server IP: 69.147.83.197 Probable Submitter: 72.85.226.82 ---- Manual Page -- http://www.php.net/manual/en/function.imagecolortransparent.php Edit -- https://master.php.net/note/edit/76407 Del: integrated -- https://master.php.net/note/delete/76407/integrated Del: useless -- https://master.php.net/note/delete/76407/useless Del: bad code -- https://master.php.net/note/delete/76407/bad+code Del: spam -- https://master.php.net/note/delete/76407/spam Del: non-english -- https://master.php.net/note/delete/76407/non-english Del: in docs -- https://master.php.net/note/delete/76407/in+docs Del: other reasons-- https://master.php.net/note/delete/76407 Reject -- https://master.php.net/note/reject/76407 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#128442) next »