note 102944 modified in function.imagepng by danbrown
| From: | danbrown@php.net | Date: | Tue, 15 Mar 2011 18:03:40 +0000 |
| Subject: | note 102944 modified in function.imagepng by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-177923@lists.php.net to get a copy of this message | ||
Creating a transparent image filled with tranparent color only
I had some hard times putting up this one:
<?php
// Set the image
$img = imagecreatetruecolor(100,100);
imagesavealpha($img, true);
// Fill the image with transparent color
$color = imagecolorallocatealpha($img,0x00,0x00,0x00,127);
imagefill($img, 0, 0, $color);
// Save the image to file.png
imagepng($img, "file.png");
// Destroy image
imagedestroy($img);
?>
--was--
Creating a transparent image filled with tranparent color only
I had some hard times putting up this one:
// Set the image
$img = imagecreatetruecolor(100,100);
imagesavealpha($img, true);
// Fill the image with transparent color
$color = imagecolorallocatealpha($img,0x00,0x00,0x00,127);
imagefill($img, 0, 0, $color);
// Save the image to file.png
imagepng($img, "file.png");
// Destroy image
imagedestroy($img);
http://php.net/manual/en/function.imagepng.php