Ejemplo n.º 1
0
 /**
  * 上传图片
  * @param $id 品牌id
  * @param $name 上传控件名
  * @param $address 图片上传后暂存地址:指的是数组结构。例:array('dd'=>array('kk'=>'da')),要将数据保存在二维数组kk下的写法 ('dd/kk')
  * @return 返回图片路径
  */
 public static function imgUpload($id = 0, $name = '', $address = '')
 {
     $id = trim($id);
     $name = trim($name);
     $address = trim($address);
     try {
         Comm::checkValue($id, Yii::t('public', '品牌号'), 1, 1);
         Comm::checkValue($name, '', 0, 1);
         Comm::checkValue($address, '', 0, 1);
     } catch (Exception $e) {
         throw new BeubeuException($e->getMessage(), $e->getCode());
     }
     $url = uploadd::imgupload($name);
     if (strpos($url, 'http://') !== false) {
         Imgcaches::imgCacheAdd($url);
         uploadd::SessionAdd($id, self::$Img_Session_name, $url, $address);
     }
     return $url;
 }