/** * 上传图片 * @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; }
/** * 删除图片 * @parm $id 衣服id * @parm $address 图片上传后暂存地址:指的是数组结构。例:array('dd'=>array('kk'=>'da')),要将数据保存在二维数组kk下的写法 ('dd/kk') */ public static function imgDelete($id = 0, $address = '') { $id = trim($id); $address = trim($address); try { Comm::checkValue($id, Yii::t('clothes', '衣服ID'), 1, 1, self::$Int_max); Comm::checkValue($address, '', 0, 1); } catch (Exception $e) { throw new BeubeuException($e->getMessage(), $e->getCode()); } uploadd::SessionAdd($id, self::$Img_Delete_Session_name, '', $address); }