Page MenuHomePhabricator

D7604.diff
No OneTemporary

D7604.diff

Index: src/applications/files/PhabricatorImageTransformer.php
===================================================================
--- src/applications/files/PhabricatorImageTransformer.php
+++ 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

Mime Type
text/plain
Expires
Wed, Oct 23, 5:44 AM (4 w, 6 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6728025
Default Alt Text
D7604.diff (911 B)

Event Timeline