Skip to content

Class 'Imagine\Gd\Imagine' not found #725

@TmorezT

Description

@TmorezT

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions