Trying to get property of non-object

Hi Guys,

im trying to use image cropbox by bupy7. I want to use it to manage a mysql table (id, name, img_path) and try to copy the cropped image into another folder in backend/web/ then i want to insert that path to my db.

But when i want to create a new row in to the db i get this error message:


PHP Notice – yii\base\ErrorException


Trying to get property of non-object

1. in C:\xampp4\htdocs\yii-application\backend\models\Cropped.php at line 64

55565758596061626364656667686970717273            'id' => 'ID',

            'name' => 'Name',

            'cropped_image' => 'Cropped Image',

            'image' => 'Cropped Image',

        ];

    }

 

    public function afterSave($insert, $changedAttributes)

    {   // open image

        $image = Image::getImagine()->open($this->image->tempName);

 

        // rendering information about crop of ONE 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 by X

        $cropInfo['y'] = $cropInfo['y']; //begin position of frame crop by Y

        // Properties bolow we don't use in this example

        //$cropInfo['ratio'] = $cropInfo['ratio'] == 0 ? 1.0 : (float)$cropInfo['ratio']; //ratio image...