1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-04 20:52:43 +01:00
phorge-phorge/src/applications/macro/controller/PhabricatorMacroMemeController.php
epriestley c7408f2797 PhabricatorMemeEngine HA HA HA HA
Summary:
Depends on D19198. Ref T13101. Ref T5258. Pull compositing logic out of the `Controller`.

This is moving toward fixing memes in email.

Test Plan: Used new and old memes. Used API memes.

Maniphest Tasks: T13101, T5258

Differential Revision: https://secure.phabricator.com/D19200
2018-03-08 11:06:52 -08:00

30 lines
755 B
PHP

<?php
final class PhabricatorMacroMemeController
extends PhabricatorMacroController {
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) {
$macro_name = $request->getStr('macro');
$upper_text = $request->getStr('uppertext');
$lower_text = $request->getStr('lowertext');
$viewer = $request->getViewer();
$file = id(new PhabricatorMemeEngine())
->setViewer($viewer)
->setTemplate($macro_name)
->setAboveText($request->getStr('above'))
->setBelowText($request->getStr('below'))
->newAsset();
$content = array(
'imageURI' => $file->getViewURI(),
);
return id(new AphrontAjaxResponse())->setContent($content);
}
}