note 77733 added to function.imagecolortransparent
| From: | kevinoeatgmail at osu1 dot php dot net | Date: | Tue, 11 Sep 2007 08:39:05 +0000 |
| Subject: | note 77733 added to function.imagecolortransparent | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-130353@lists.php.net to get a copy of this message | ||
To resize a transparent image into a thumbnail while keeping its transparency. The quality of the
thumbnail is pretty bad though.. but it is transparent.
$image = ImageCreateFromGIF('transparentimage.gif');
$img_width = ImagesX($image);
$img_height = ImagesY($image);
$new_width = '100';
$new_height = ($new_width * $img_height) / $img_width;
$resized = imagecreatetruecolor($new_width, $new_height);
$colorTransparent = imagecolortransparent($image);
imagepalettecopy($image, $resized);
imagefill($resized, 0, 0, $colorTransparent);
imagecolortransparent($resized, $colorTransparent);
imagetruecolortopalette($resized, true, 256);
imagecopyresized($resized, $image, 0, 0, 0, 0, $new_width, $new_height, $img_width, $img_height);
----
Server IP: 62.73.196.231
Probable Submitter: 195.0.209.132
----
Manual Page -- http://www.php.net/manual/en/function.imagecolortransparent.php
Edit -- https://master.php.net/note/edit/77733
Del: integrated -- https://master.php.net/note/delete/77733/integrated
Del: useless -- https://master.php.net/note/delete/77733/useless
Del: bad code -- https://master.php.net/note/delete/77733/bad+code
Del: spam -- https://master.php.net/note/delete/77733/spam
Del: non-english -- https://master.php.net/note/delete/77733/non-english
Del: in docs -- https://master.php.net/note/delete/77733/in+docs
Del: other reasons-- https://master.php.net/note/delete/77733
Reject -- https://master.php.net/note/reject/77733
Search -- https://master.php.net/manage/user-notes.php