@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.

When `{meme ...}` embed has no text, just use the raw file data unmodified

Summary:
Ref T13216. See PHI948. When you use the remarkup hint button to embed a meme with no text, you get `{meme src=X}`.

If the source is a GIF, we currently split the source apart into frame-by-frame images, process them, and stitch them back together. The end result is the same image we started with, but this process can be slow/expensive, and may timeout for sufficiently large GIFs.

Instead: when there's no text, just return the original image data.

Test Plan:
- Used `{meme src=X}` with no text, got an image faster.
- Used `{meme src=X, above=...}` to add text, got an attempt to add text (which didn't get very far locally since I don't have GD configured).

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13216

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

+9
+9
src/applications/macro/engine/PhabricatorMemeEngine.php
··· 174 174 private function newAssetData(PhabricatorFile $template) { 175 175 $template_data = $template->loadFileData(); 176 176 177 + // When we aren't adding text, just return the data unmodified. This saves 178 + // us from doing expensive stitching when we aren't actually making any 179 + // changes to the image. 180 + $above_text = $this->getAboveText(); 181 + $below_text = $this->getBelowText(); 182 + if (!strlen(trim($above_text)) && !strlen(trim($below_text))) { 183 + return $template_data; 184 + } 185 + 177 186 $result = $this->newImagemagickAsset($template, $template_data); 178 187 if ($result) { 179 188 return $result;