controllers/AdminController.php
public function actionUpdateImage($id)
    {
        $model = $this->module->manager->findGalleryImageById($id);
        if ($model === null) {
            throw new NotFoundHttpException('The requested image does not exist');
        }
        $model->scenario = 'update';

        $gallery = $this->findModel($model->gallery_id);

        if ($model->load(\Yii::$app->request->post()) && $model->save()) {
            if(\Yii::$app->request->get('returnUrl')){
                $back = urldecode(\Yii::$app->request->get('returnUrl'));
                return $this->redirect($back);
            }

            \Yii::$app->getSession()->setFlash('gallery.success', \Yii::t('gallery', 'Image has been updated'));
            return $this->refresh();
        }

        return $this->render('image/update', [
            'model' => $model,
            'gallery' => $gallery
        ]);
    }
public function actionUpdateImage($id)
    {
        $model = $this->module->manager->findGalleryImageById($id);
        if ($model === null) {
            throw new NotFoundHttpException('The requested image does not exist');
        }
        $model->scenario = 'update';

        $gallery = $this->findModel($model->gallery_id);

        if ($model->load(\Yii::$app->request->post()) && $model->save()) {
            if(\Yii::$app->request->get('returnUrl')){
                $back = urldecode(\Yii::$app->request->get('returnUrl'));
                return $this->redirect($back);
            }

            \Yii::$app->getSession()->setFlash('gallery.success', \Yii::t('gallery', 'Image has been updated'));
            return $this->refresh();
        }

        return $this->render('image/update', [
            'model' => $model,
            'gallery' => $gallery
        ]);
    }
public function actionUpdateImage ( $ id ) { $ model = $ this -> module -> manager -> findGalleryImageById ( $ id ) ; if ( $ model === null ) { throw new NotFoundHttpException ( 'The requested image does not exist' ) ; } $ model -> scenario = 'update' ; $ gallery = $ this -> findModel ( $ model -> gallery_id ) ; if ( $ model -> load ( \ Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { if ( \ Yii :: $ app -> request -> get ( 'returnUrl' ) ) { $ back = urldecode ( \ Yii :: $ app -> request -> get ( 'returnUrl' ) ) ; return $ this -> redirect ( $ back ) ; } \ Yii :: $ app -> getSession ( ) -> setFlash ( 'gallery.success' , \ Yii :: t ( 'gallery' , 'Image has been updated' ) ) ; return $ this -> refresh ( ) ; } return $ this -> render ( 'image/update' , [ 'model' => $ model , 'gallery' => $ gallery ] ) ; }
Updates an existing GalleryImage model.
If update is successful, the browser will be redirected to the 'images' page.

@param  integer $id
@return mixed
@throws NotFoundHttpException
Updates an existing GalleryImage model . If update is successful the browser will be redirected to the images page .