Esempio n. 1
0
 /**
  * 图片处理
  *
  * @param PwUploadAction $bhv 上传行为
  * @param object 存储对象
  * @return bool|PwError
  */
 public function operateImage($bhv, $store)
 {
     $image = new PwImage($this->source);
     if (!$image->isImage()) {
         return new PwError('upload.content.error');
     }
     if ($image->ext != 'swf') {
         if (!$image->getSource() && $image->ext != 'bmp') {
             return new PwError('upload.content.error');
         }
         if ($bhv->allowThumb()) {
             $this->makeThumb($image, $bhv->getThumbInfo($this->filename, $this->savedir), $store);
         }
         if ($bhv->allowWaterMark()) {
             $waterinfo = $bhv->getWaterMarkInfo();
             $this->watermark($image, $waterinfo);
             foreach ($this->_thumb as $value) {
                 $this->watermark(new PwImage($value[0]), $waterinfo);
             }
         }
         $this->type = 'img';
     }
     return true;
 }
Esempio n. 2
0
 /**
  * @see PwUploadAction.fileError
  */
 public function fileError(PwUploadFile $file)
 {
     parent::fileError($file);
     $srv = Wekit::load('WSRV:user.srv.WindidUserService');
     $srv->defaultAvatar($this->uid);
 }
Esempio n. 3
0
 /**
  * 图片处理
  *
  * @param PwUploadAction $bhv 上传行为
  * @param object 存储对象
  * @return bool|PwError
  */
 public function operateImage($bhv, $store)
 {
     $image = new WindidImage($this->source);
     if (!$image->isImage()) {
         return new WindidError(WindidError::UPLOAD_CONTENT_ERROR);
     }
     if ($image->ext != 'swf') {
         if (!$image->getSource() && $image->ext != 'bmp') {
             return new WindidError(WindidError::UPLOAD_CONTENT_ERROR);
         }
         if ($bhv->allowThumb()) {
             $this->makeThumb($image, $bhv->getThumbInfo($this->filename, $this->savedir), $store);
         }
         /*if ($bhv->allowWaterMark()) {
         			$waterinfo = $bhv->getWaterMarkInfo();
         			$this->watermark($image, $waterinfo);
         			foreach ($this->_thumb as $value) {
         				$this->watermark(new WindidImage($value[0]), $waterinfo);
         			}
         		}*/
         $this->type = 'img';
     }
     return true;
 }