note 110186 added to function.imagefill

From: Date: Thu, 27 Sep 2012 23:19:12 +0000
Subject: note 110186 added to function.imagefill
Groups: php.notes 
Request: Send a blank email to php-notes+get-191049@lists.php.net to get a copy of this message
Creating a new true-color image, filling it with a transparent color, and saving it as a PNG image can be accomplished with the following: <?php $new = imagecreatetruecolor(320, 320); $color = imagecolorallocatealpha($new, 0, 0, 0, 127); imagefill($new, 0, 0, $color); imagesavealpha($new, TRUE); // it took me a good 10 minutes to figure this part out imagepng($new); ?> The image needs to be created with imagecreatetruecolor(), you must use imagefill() instead of imagefilledrectange(), and you need to call imagesavealpha(). No other combination of functions calls seems to produce the intended results. ---- Server IP: 64.68.200.35 Probable Submitter: 154.5.0.154 ---- Manual Page -- http://www.php.net/manual/en/function.imagefill.php Edit -- https://master.php.net/note/edit/110186 Del: integrated -- https://master.php.net/note/delete/110186/integrated Del: useless -- https://master.php.net/note/delete/110186/useless Del: bad code -- https://master.php.net/note/delete/110186/bad+code Del: spam -- https://master.php.net/note/delete/110186/spam Del: non-english -- https://master.php.net/note/delete/110186/non-english Del: in docs -- https://master.php.net/note/delete/110186/in+docs Del: other reasons-- https://master.php.net/note/delete/110186 Reject -- https://master.php.net/note/reject/110186 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#191049) next »