note 40474 added to function.imagecolortransparent
| From: | shelley_hina at yahoo dot com | Date: | Thu, 04 Mar 2004 16:35:51 +0000 |
| Subject: | note 40474 added to function.imagecolortransparent | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-66263@lists.php.net to get a copy of this message | ||
It took me a while to figure this out. I added visual web thumbnail preview graphic from http://www.thumbshots.org and http://www.thumbshots.com to my customer sites to visualize web
pages. Then I needed to create a small blank transparent PNG image if the thumbshot is not
available. You can do this easily using imagecolortransparent function. It came out really nice and
fast. It's very cool stuff and highly recommended library for all your web site needs!
// Use GD library to create transparent color PNG image of the pixel size
$ImgGD = imagecreate(120, 90);
$ImgWhite = imagecolorallocate($ImgGD, 255, 255, 255);
imagefill($ImgGD, 0, 0, $ImgWhite);
imagecolortransparent($ImgGD, $ImgWhite);
// Capture STDOUT to buffer
ob_start();
imagepng($ImgGD);
$Image = ob_get_contents();
ob_end_clean();
// Remember to free your memory
imagedestroy($ImgGD);
// Print image to web browser.
print $Image
----
Manual Page -- http://www.php.net/manual/en/function.imagecolortransparent.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40474
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40474&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40474&report=yes
Search -- http://master.php.net/manage/user-notes.php