check() 공개 정적인 메소드

Checks if GD is enabled and bundled. Bundled GD is required for some methods to work. Exceptions will be thrown from those methods when GD is not bundled.
public static check ( ) : boolean
리턴 boolean
예제 #1
0
파일: gd.php 프로젝트: homm/image
 public function __construct($file)
 {
     if (!Image_GD::$_checked) {
         // Run the install check
         Image_GD::check();
     }
     parent::__construct($file);
     // Set the image creation function name
     switch ($this->type) {
         case IMAGETYPE_JPEG:
             $create = 'imagecreatefromjpeg';
             break;
         case IMAGETYPE_GIF:
             $create = 'imagecreatefromgif';
             break;
         case IMAGETYPE_PNG:
             $create = 'imagecreatefrompng';
             break;
     }
     if (!isset($create) or !function_exists($create)) {
         throw new Kohana_Exception('Installed GD does not support :type images', array(':type' => image_type_to_extension($this->type, FALSE)));
     }
     // Save function for future use
     $this->_create_function = $create;
     // Save filename for lazy loading
     $this->_image = $this->file;
 }
예제 #2
0
파일: gd.php 프로젝트: joelpittet/image
 public function __construct($file)
 {
     if (!Image_GD::$_checked) {
         // Run the install check
         Image_GD::check();
     }
     parent::__construct($file);
     // Set the image creation function name
     switch ($this->type) {
         case IMAGETYPE_JPEG:
             $create = 'imagecreatefromjpeg';
             break;
         case IMAGETYPE_GIF:
             $create = 'imagecreatefromgif';
             break;
         case IMAGETYPE_PNG:
             $create = 'imagecreatefrompng';
             break;
     }
     if (!isset($create) or !function_exists($create)) {
         throw new Kohana_Exception('Installed GD does not support :type images', array(':type' => image_type_to_extension($this->type, FALSE)));
     }
     // Open the temporary image
     $this->_image = $create($this->file);
     // Preserve transparency when saving
     imagesavealpha($this->_image, TRUE);
 }