note 79297 added to function.imagecopyresampled
| From: | matt1walshDESPAMMERgmaildotcom at osu1 dot php dot net | Date: | Tue, 20 Nov 2007 03:15:26 +0000 |
| Subject: | note 79297 added to function.imagecopyresampled | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132419@lists.php.net to get a copy of this message | ||
None of the stuff I've seen for resizing transparent GIFs works consistently and yields a good
image. The hack I thought of is silly, but it works okay -- convert GIF to PNG. This worked for me.
$g_iw is new image width
$g_ih is new image height
$img_src=imagecreatefromgif($g_srcfile);
$img_dst=imagecreatetruecolor($g_iw,$g_ih);
//preserve alpha
imagecolortransparent($img_dst, imagecolorallocate($img_dst, 0, 0, 0));
imagealphablending($img_dst, false);
imagesavealpha($img_dst, true);
imagecopyresampled($img_dst, $img_src, 0, 0, 0, 0, $g_iw, $g_ih, $g_is[0], $g_is[1]);
imagepng($img_dst, $g_dstfile);
imagedestroy($img_dst);
----
Server IP: 208.69.120.35
Probable Submitter: 68.246.136.188
----
Manual Page -- http://www.php.net/manual/en/function.imagecopyresampled.php
Edit -- https://master.php.net/note/edit/79297
Del: integrated -- https://master.php.net/note/delete/79297/integrated
Del: useless -- https://master.php.net/note/delete/79297/useless
Del: bad code -- https://master.php.net/note/delete/79297/bad+code
Del: spam -- https://master.php.net/note/delete/79297/spam
Del: non-english -- https://master.php.net/note/delete/79297/non-english
Del: in docs -- https://master.php.net/note/delete/79297/in+docs
Del: other reasons-- https://master.php.net/note/delete/79297
Reject -- https://master.php.net/note/reject/79297
Search -- https://master.php.net/manage/user-notes.php