1234567891011121314151617181920212223 |
- <?php
- /**
- * Created by PhpStorm.
- * User: xiaofeng
- * Date: 2018/3/23
- * Time: 下午1:48
- */
- namespace backend\event;
- use yii\base\Component;
- use Yii;
- class TinifyEvent extends Component
- {
- const EVENT_COMPRESS = 'compress_img'; //压缩图片
- public function CompressImg($arr)
- {
- $Help = new \backend\base\Help(); //静态方法无需new
- $arr['path'] = Yii::$app->params['tinifyUrl'];
- $arr['data']['uid'] = Yii::$app->session['user_info']['uid'];
- $this->on(self::EVENT_COMPRESS,[$Help,'AjaxRequest'],$arr);
- $this->trigger(self::EVENT_COMPRESS);
- }
- }
|