Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F84160
D7604.diff
All Users
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
911 B
Referenced Files
None
Subscribers
None
D7604.diff
View Options
diff --git a/src/applications/files/PhabricatorImageTransformer.php b/src/applications/files/PhabricatorImageTransformer.php
--- a/src/applications/files/PhabricatorImageTransformer.php
+++ b/src/applications/files/PhabricatorImageTransformer.php
@@ -294,6 +294,15 @@
$lower_text,
$mime_type) {
$img = imagecreatefromstring($data);
+
+ // Some PNGs have color palettes, and allocating the dark border color
+ // fails and gives us whatever's first in the color table. Copy the image
+ // to a fresh truecolor canvas before working with it.
+
+ $truecolor = imagecreatetruecolor(imagesx($img), imagesy($img));
+ imagecopy($truecolor, $img, 0, 0, 0, 0, imagesx($img), imagesy($img));
+ $img = $truecolor;
+
$phabricator_root = dirname(phutil_get_library_root('phabricator'));
$font_root = $phabricator_root.'/resources/font/';
$font_path = $font_root.'tuffy.ttf';
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/2d/nw/33vw7jveyqbszy4u
Default Alt Text
D7604.diff (911 B)
Attached To
Mode
D7604: Fix meme generation for palette PNGs
Attached
Detach File
Event Timeline
Log In to Comment