class imagine/gd/imagine not found in yii2 -


class 'imagine\gd\imagine' not found

i using cropbox extension in yii2 , throughing error although namespace yii/imagine used in model file

following model class file

namespace app\models;  use yii; use yii\imagine; use yii\imagine\image; // use yii\imagine\gd; use yii\helpers\json; use imagine\image\box; use imagine\image\point; /**  * model class table "tbl_slider_pics".  *  * @property integer $id  * @property string $path  * @property integer $status  * @property string $ip  * @property string $crt_by  * @property string $crt_time  * @property string $mod_by  * @property string $mod_time  */ class tblsliderpics extends \yii\db\activerecord {     /**      * @inheritdoc      */      public $image;     public $crop_info;      public static function tablename()     {         return 'tbl_slider_pics';     }      /**      * @inheritdoc      */     public function rules()     {         return [             [['path'], 'required'],             [['status'], 'integer'],             [['path'], 'string', 'max' => 2000],             [['ip'], 'string', 'max' => 30],             [['crt_by', 'mod_by'], 'string', 'max' => 50],             [['crt_time', 'mod_time'], 'string', 'max' => 20], [         'image',          'image',          'extensions' => ['jpg', 'jpeg', 'png', 'gif'],         'mimetypes' => ['image/jpeg', 'image/pjpeg', 'image/png', 'image/gif'],     ],     ['crop_info', 'safe'],         ];     }      /**      * @inheritdoc      */     public function attributelabels()     {         return [             'id' => 'id',             'path' => 'path',             'status' => 'status',             'ip' => 'ip',             'crt_by' => 'crt by',             'crt_time' => 'crt time',             'mod_by' => 'mod by',             'mod_time' => 'mod time',         ];     }  public function aftersave($insert, $changedattributes) {    // open image     $image = image::getimagine()->open($this->image->tempname);      // rendering information crop of 1 option      $cropinfo = json::decode($this->crop_info)[0];     $cropinfo['dwidth'] = (int)$cropinfo['dwidth']; //new width image     $cropinfo['dheight'] = (int)$cropinfo['dheight']; //new height image     $cropinfo['x'] = $cropinfo['x']; //begin position of frame crop x     $cropinfo['y'] = $cropinfo['y']; //begin position of frame crop y     // properties bolow don't use in example     //$cropinfo['ratio'] = $cropinfo['ratio'] == 0 ? 1.0 : (float)$cropinfo['ratio']; //ratio image.      //$cropinfo['width'] = (int)$cropinfo['width']; //width of cropped image     //$cropinfo['height'] = (int)$cropinfo['height']; //height of cropped image     //$cropinfo['swidth'] = (int)$cropinfo['swidth']; //width of source image     //$cropinfo['sheight'] = (int)$cropinfo['sheight']; //height of source image      //delete old images     $oldimages = filehelper::findfiles(yii::getalias('/home/sweet947/public_html/fortaj.ca/backend/uploads/'), [         'only' => [             $this->id . '.*',             'thumb_' . $this->id . '.*',         ],      ]);     ($i = 0; $i != count($oldimages); $i++) {         @unlink($oldimages[$i]);     }      //saving thumbnail     $newsizethumb = new box($cropinfo['dwidth'], $cropinfo['dheight']);     $cropsizethumb = new box(200, 200); //frame size of crop     $croppointthumb = new point($cropinfo['x'], $cropinfo['y']);     $paththumbimage = yii::getalias('/home/sweet947/public_html/fortaj.ca/backend/uploads/')          . '/thumb_'          . $this->id          . '.'          . $this->image->getextension();        $image->resize($newsizethumb)         ->crop($croppointthumb, $cropsizethumb)         ->save($paththumbimage, ['quality' => 100]);      //saving original     $this->path->saveas(         yii::getalias('/home/sweet947/public_html/fortaj.ca/backend/uploads/')          . '/'          . $this->id          . '.'          . $this->image->getextension()     ); } } 

please me!!


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

post - imageshack API cURL -

dataset - MPAndroidchart returning no chart Data available -