コード例 #1
0
ファイル: Sizer.php プロジェクト: schpill/thin
 /**
  * Instantiates the Resizer and receives the path to an image we're working with.
  * @param mixed $file The file array provided by a path to a file
  */
 function __construct($file)
 {
     // Load the config from the main application first, if it's not available
     Config::load('sizer');
     $this->config = Config::get('sizer');
     // Open up the file.
     $this->image = $this->openImage($file);
     if (!$this->image) {
         throw new Exception('File not recognised. Possibly because the path is wrong. Keep in mind, paths are relative to the main index.php file.');
     }
     // Get width and height of our image.
     $this->width = imagesx($this->image);
     $this->height = imagesy($this->image);
 }