Path: blob/master/src/applications/config/check/PhabricatorGDSetupCheck.php
12256 views
<?php12final class PhabricatorGDSetupCheck extends PhabricatorSetupCheck {34public function getDefaultGroup() {5return self::GROUP_OTHER;6}78protected function executeChecks() {9if (!extension_loaded('gd')) {10$message = pht(11"The '%s' extension is not installed. Without '%s', support, ".12"this server will not be able to process or resize images ".13"(for example, to generate thumbnails). Install or enable '%s'.",14'gd',15'gd',16'gd');1718$this->newIssue('extension.gd')19->setName(pht("Missing '%s' Extension", 'gd'))20->setMessage($message)21->addPHPExtension('gd');22} else {23$image_type_map = array(24'imagecreatefrompng' => 'PNG',25'imagecreatefromgif' => 'GIF',26'imagecreatefromjpeg' => 'JPEG',27);2829$have = array();30foreach ($image_type_map as $function => $image_type) {31if (function_exists($function)) {32$have[] = $image_type;33}34}3536$missing = array_diff($image_type_map, $have);37if ($missing) {38$missing = implode(', ', $missing);39$have = implode(', ', $have);4041$message = pht(42"The '%s' extension has support for only some image types. ".43"This server will be unable to process images of the missing ".44"types until you build '%s' with support for them. ".45"Supported types: %s. Missing types: %s.",46'gd',47'gd',48$have,49$missing);5051$this->newIssue('extension.gd.support')52->setName(pht("Partial '%s' Support", 'gd'))53->setMessage($message);54}55}56}57}585960