-
Notifications
You must be signed in to change notification settings - Fork 532
Closed
Description
Kindly help solve this issue. I'm trying to upload a profile pic it brings this error kindly assist, I'm using yii2.
Class 'Imagine\Gd\Imagine' not found
the code is this
422423424425426427428429430431432433434435436437438439440 $ext = "png";
// generate a unique file name to prevent duplicate filenames
$model->user_photo = Yii::$app->user->identity->user_name . "_ppic.{$ext}"; //Yii::$app->security->generateRandomString().".{$ext}";
// the path to save file, you can set an uploadPath
// in Yii::$app->params (as used in example below)
Yii::$app->params['uploadPath'] = "uploads/user_image/";
$path = Yii::$app->params['uploadPath'] . $model->user_photo;
$image->saveAs($path);
$imagine = new Imagine();
$photo = $imagine->open($path);
$photo->thumbnail(new Box(160, 160))->save($path, ['quality' => 90]);
if ($model->save()) {
Yii::$app->session->set("UserImage", $model->user_photo);
//return $this->redirect(['profile']);
Yii::$app->session->setFlash('success', 'Profile updated successfully');
return $this->redirect(Yii::$app->request->referrer); //$this->goHome();
Metadata
Metadata
Assignees
Labels
No labels