예제 #1
0
 /**
  * Sets a new profile image by given temp file
  *
  * @param CUploadedFile $file
  */
 public function setNew($file)
 {
     $this->delete();
     ImageConverter::TransformToJpeg($file->tempName, $this->getPath('_org'));
     ImageConverter::Resize($this->getPath('_org'), $this->getPath('_org'), array('width' => 1134, 'mode' => 'max'));
     ImageConverter::Resize($this->getPath('_org'), $this->getPath(''), array('width' => $this->width, 'height' => $this->height));
 }
예제 #2
0
 /**
  * Sets a new logo image by given temp file
  *
  * @param CUploadedFile $file
  */
 public function setNew(UploadedFile $file)
 {
     $this->delete();
     move_uploaded_file($file->getTempName(), $this->getPath());
     ImageConverter::Resize($this->getPath(), $this->getPath(), array('height' => $this->height, 'width' => 0, 'mode' => 'max', 'transparent' => $file->getExtensionName() == 'png' && ImageConverter::checkTransparent($this->getPath())));
 }
예제 #3
0
 /**
  * Sets a new profile image by given temp file
  *
  * @param mixed $file CUploadedFile or file path
  */
 public function setNew($file)
 {
     if ($file instanceof \yii\web\UploadedFile) {
         $file = $file->tempName;
     }
     $this->delete();
     ImageConverter::TransformToJpeg($file, $this->getPath('_org'));
     ImageConverter::Resize($this->getPath('_org'), $this->getPath('_org'), array('width' => 400, 'mode' => 'max'));
     ImageConverter::Resize($this->getPath('_org'), $this->getPath(''), array('width' => $this->width, 'height' => $this->height));
 }