modules/admin/controllers/TailorController.php
/**
     * Deletes an existing image from perticular field.
     * If deletion is successful, success message will get in update page result.
     * @param integer $id
     * @return mixed
     * @throws NotFoundHttpException if the model cannot be found
     */
Deletes an existing image from perticular field.
If deletion is successful, success message will get in update page result.
@param integer $id
@return mixed
@throws NotFoundHttpException if the model cannot be found
Deletes an existing image from perticular field . If deletion is successful success message will get in update page result . @param integer $id @return mixed @throws NotFoundHttpException if the model cannot be found
public function actionImageDelete($id)
    {
        $model = $this->findModel($id);
        $uploadDirPath = Yii::getAlias('@tailorShopImageRelativePath');
        $uploadThumbDirPath = Yii::getAlias('@tailorShopImageThumbRelativePath');
        if (file_exists($uploadDirPath . '/' . $model->shop_image) && !empty($model->shop_image)) {
            unlink($uploadDirPath . '/' . $model->shop_image);
        }
        if (file_exists($uploadThumbDirPath . '/' . $model->shop_image) && !empty($model->shop_image)) {
            unlink($uploadThumbDirPath . '/' . $model->shop_image);
        }
        $model->shop_image = null;
        if ($model->save()) {
            return Json::encode(['success' => 'image successfully deleted']);
        }
    }
public function actionImageDelete ( $ id ) { $ model = $ this -> findModel ( $ id ) ; $ uploadDirPath = Yii :: getAlias ( '@tailorShopImageRelativePath' ) ; $ uploadThumbDirPath = Yii :: getAlias ( '@tailorShopImageThumbRelativePath' ) ; if ( file_exists ( $ uploadDirPath . '/' . $ model -> shop_image ) && ! empty ( $ model -> shop_image ) ) { unlink ( $ uploadDirPath . '/' . $ model -> shop_image ) ; } if ( file_exists ( $ uploadThumbDirPath . '/' . $ model -> shop_image ) && ! empty ( $ model -> shop_image ) ) { unlink ( $ uploadThumbDirPath . '/' . $ model -> shop_image ) ; } $ model -> shop_image = null ; if ( $ model -> save ( ) ) { return Json :: encode ( [ 'success' => 'image successfully deleted' ] ) ; } }
Deletes an existing image from perticular field.
Deletes an existing image from perticular field .
// unlink images with thumb