<?php
namespace frontend\helpers;

use Yii;

class ImageUtil extends \common\helpers\ImageUtil
{
    public $echo_error = true;

    /**
     * 重写父类方法，可以不直接输出错误，而是抛出异常，交给其他方法处理错误
     * @param string $msg
     * @throws \Exception
     */
    protected function alert($msg)
    {
        if ($this->echo_error) {
            header('Content-type: text/html; charset=UTF-8');
            echo json_encode(['error' => 1, 'message' => $msg]);
            exit;    
        } else {
            throw new \Exception($msg);       
        }
    }
    
}