1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Preserve transparency in thumbnails

Summary: Add some code from a random guy on the Internet.

Test Plan: Upload a PNG file with alpha; check thumbnail.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1646

Differential Revision: https://secure.phabricator.com/D3258
This commit is contained in:
Alan Huang 2012-08-13 12:31:13 -07:00
parent 1379876db7
commit 29e176fe53

View file

@ -88,6 +88,8 @@ final class PhabricatorImageTransformer {
$scale = min($x / $dx, $y / $dy);
$dst = imagecreatetruecolor($dx, $dy);
imagesavealpha($dst, true);
imagefill($dst, 0, 0, imagecolorallocatealpha($dst, 0, 0, 0, 127));
// If we need to chop off some pixels, chop them off from the sides instead
// of scaling in on <0, 0>.