Blame view

common/components/artboximage/ArtboxImage.php 750 Bytes
d8c1a2e0   Yarik   Big commit artbox
1
2
3
4
  <?php
  
  namespace common\components\artboximage;
  
d8c1a2e0   Yarik   Big commit artbox
5
6
  use yii\base\Component;
  use yii\base\ErrorException;
d8c1a2e0   Yarik   Big commit artbox
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  use yii\image\drivers\Image;
  
  //use common\components\artboximage\drivers\Image;
  
  class ArtboxImage extends Component {
  
      public $driver;
  
      public $presets = [];
  
      public $rootPath;
      public $rootUrl;
  
      public $extensions = [
          'jpg' => 'jpeg',
          'jpeg' => 'jpeg',
          'png' => 'png',
          'gif' => 'gif',
          'bmp' => 'bmp',
      ];
5c2eb7c8   Yarik   Big commit almost...
27
      
d8c1a2e0   Yarik   Big commit artbox
28
29
30
31
32
33
      public function load($file = null, $driver = null) {
          if(empty($file) || !realpath($file)) {
              throw new ErrorException('File name can not be empty and exists');
          }
          return Image::factory($file, $driver ? $driver : $this->driver);
      }
d8c1a2e0   Yarik   Big commit artbox
34
  }