public function saveFile()
{
if (!$this->resizeOnUpload) {
parent::saveFile();
return;
}
$newFileName = $this->getFileName();
$path = Yii::app()->uploadManager->getFilePath($newFileName, $this->getUploadPath());
if (!YFile::checkPath(pathinfo($path, PATHINFO_DIRNAME))) {
throw new \CHttpException(500, Yii::t('YupeModule.yupe', 'Directory "{dir}" is not acceptable for write!', array('{dir}' => $path)));
}
/*
$image = Imagine::resize(
$this->_currentFile->getTempName(),
$this->resizeOptions['width'],
$this->resizeOptions['height']
);
$image->save(
$path,
$this->resizeOptions['quality']
);
*
*/
$image = Yii::app()->image->load($this->_currentFile->getTempName())->quality($this->resizeOptions['quality']);
$image->resize($this->resizeOptions['width'], $this->resizeOptions['height'], $this->resizeOptions['master']);
$image->save($path);
$this->getOwner()->{$this->attributeName} = $newFileName;
$this->_prevFile = $this->getPrevFile();
}