@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix meme generation for palette PNGs

Summary: Fixes T4125. Indexed / palette PNGs may fail to allocate a proper black for drawing an image border.

Test Plan: {F83066}

Reviewers: btrahan, asukhachev

Reviewed By: asukhachev

CC: aran

Maniphest Tasks: T4125

Differential Revision: https://secure.phabricator.com/D7604

+9
+9
src/applications/files/PhabricatorImageTransformer.php
··· 294 294 $lower_text, 295 295 $mime_type) { 296 296 $img = imagecreatefromstring($data); 297 + 298 + // Some PNGs have color palettes, and allocating the dark border color 299 + // fails and gives us whatever's first in the color table. Copy the image 300 + // to a fresh truecolor canvas before working with it. 301 + 302 + $truecolor = imagecreatetruecolor(imagesx($img), imagesy($img)); 303 + imagecopy($truecolor, $img, 0, 0, 0, 0, imagesx($img), imagesy($img)); 304 + $img = $truecolor; 305 + 297 306 $phabricator_root = dirname(phutil_get_library_root('phabricator')); 298 307 $font_root = $phabricator_root.'/resources/font/'; 299 308 $font_path = $font_root.'tuffy.ttf';