3 final class PhabricatorGDSetupCheck
extends PhabricatorSetupCheck
{
5 public function getDefaultGroup() {
6 return self
::GROUP_OTHER
;
9 protected function executeChecks() {
10 if (!extension_loaded('gd')) {
12 "The '%s' extension is not installed. Without '%s', support, ".
13 "Phabricator will not be able to process or resize images ".
14 "(for example, to generate thumbnails). Install or enable '%s'.",
19 $this->newIssue('extension.gd')
20 ->setName(pht("Missing '%s' Extension", 'gd'))
21 ->setMessage($message)
22 ->addPHPExtension('gd');
24 $image_type_map = array(
25 'imagecreatefrompng' => 'PNG',
26 'imagecreatefromgif' => 'GIF',
27 'imagecreatefromjpeg' => 'JPEG',
31 foreach ($image_type_map as $function => $image_type) {
32 if (function_exists($function)) {
33 $have[] = $image_type;
37 $missing = array_diff($image_type_map, $have);
39 $missing = implode(', ', $missing);
40 $have = implode(', ', $have);
43 "The '%s' extension has support for only some image types. ".
44 "Phabricator will be unable to process images of the missing ".
45 "types until you build '%s' with support for them. ".
46 "Supported types: %s. Missing types: %s.",
52 $this->newIssue('extension.gd.support')
53 ->setName(pht("Partial '%s' Support", 'gd'))
54 ->setMessage($message);