/** * 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)); }
/** * 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)); }