note 93166 added to function.imagecopyresampled
| From: | asgaroth dot belem at gmail dot com | Date: | Wed, 26 Aug 2009 18:38:01 +0000 |
| Subject: | note 93166 added to function.imagecopyresampled | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159907@lists.php.net to get a copy of this message | ||
About preserving the transparency when resizing PNGs this was the only thing that worked for me:
<?php imagealphablending($new_watermark, false);
$color = imagecolortransparent($new_watermark, imagecolorallocatealpha($new_watermark, 0, 0, 0,
127));
imagefill($new_watermark, 0, 0, $color);
imagesavealpha($new_watermark, true);
imagecopyresampled($new_watermark, $watermark, 0, 0, 0, 0, $new_watermark_width,
$new_watermark_height, imagesx($watermark),imagesy($watermark));
?>
Tried without success:
<?php imagealphablending($new_watermark, false);
$color = imagecolortransparent($new_watermark, imagecolorallocate($new_watermark, 0, 0, 0));
imagefill($new_watermark, 0, 0, $color);
imagesavealpha($new_watermark, true);
imagecopyresampled($new_watermark, $watermark, 0, 0, 0, 0, $new_watermark_width,
$new_watermark_height, imagesx($watermark),imagesy($watermark));
?>
hope it helps someone.
----
Server IP: 69.147.83.197
Probable Submitter: 190.146.155.154
----
Manual Page -- http://www.php.net/manual/en/function.imagecopyresampled.php
Edit -- https://master.php.net/note/edit/93166
Del: integrated -- https://master.php.net/note/delete/93166/integrated
Del: useless -- https://master.php.net/note/delete/93166/useless
Del: bad code -- https://master.php.net/note/delete/93166/bad+code
Del: spam -- https://master.php.net/note/delete/93166/spam
Del: non-english -- https://master.php.net/note/delete/93166/non-english
Del: in docs -- https://master.php.net/note/delete/93166/in+docs
Del: other reasons-- https://master.php.net/note/delete/93166
Reject -- https://master.php.net/note/reject/93166
Search -- https://master.php.net/manage/user-notes.php