[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/config/check/ -> PhabricatorSetupCheckGD.php (source)

   1  <?php
   2  
   3  final class PhabricatorSetupCheckGD extends PhabricatorSetupCheck {
   4  
   5    protected function executeChecks() {
   6      if (!extension_loaded('gd')) {
   7        $message = pht(
   8          "The 'gd' extension is not installed. Without 'gd', support, ".
   9          "Phabricator will not be able to process or resize images ".
  10          "(for example, to generate thumbnails). Install or enable 'gd'.");
  11  
  12        $this->newIssue('extension.gd')
  13          ->setName(pht("Missing 'gd' Extension"))
  14          ->setMessage($message);
  15      } else {
  16        $image_type_map = array(
  17          'imagecreatefrompng'  => 'PNG',
  18          'imagecreatefromgif'  => 'GIF',
  19          'imagecreatefromjpeg' => 'JPEG',
  20        );
  21  
  22        $have = array();
  23        foreach ($image_type_map as $function => $image_type) {
  24          if (function_exists($function)) {
  25            $have[] = $image_type;
  26          }
  27        }
  28  
  29        $missing = array_diff($image_type_map, $have);
  30        if ($missing) {
  31          $missing = implode(', ', $missing);
  32          $have = implode(', ', $have);
  33  
  34          $message = pht(
  35            "The 'gd' extension has support for only some image types. ".
  36            "Phabricator will be unable to process images of the missing ".
  37            "types until you build 'gd' with support for them. ".
  38            "Supported types: %s. Missing types: %s.",
  39            $have,
  40            $missing);
  41  
  42          $this->newIssue('extension.gd.support')
  43            ->setName(pht("Partial 'gd' Support"))
  44            ->setMessage($message);
  45        }
  46      }
  47    }
  48  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1