protected function processImage() { $imageConv = new \CNSNImageConv(); $Newfile = $this->getImageFile(); $size = App::getAppC()['UserModelImageSize']; if (isset($this->imageSelection)) { $imageConv->process($this->image->getTmpName(), $Newfile, 'ASPECT_RATIO', $this->imageSelection['width'], $this->imageSelection['height']); $imageConv->crop($this->imageSelection['x1'], $this->imageSelection['y1'], $this->imageSelection['width'], $this->imageSelection['height'], true); $imageConv->process($Newfile, $Newfile, 'EXACT', $size['width'], $size['height']); $imageConv->resize(true, true); } else { $imageConv->process($this->image->getTmpName(), $Newfile, 'EXACT', $size['width'], $size['height']); $imageConv->resize(true, true); } }
/** Set Uploaded object and fill attributes * @param $name */ public function setUploadedFile($name) { $this->_uploadedFile = new UploadedFile($name, $this); $a = $this->_uploadedFile->toArray(false); $this->setAttributes(array('userid' => App::user()->userid, 'upload_name' => $a['name'], 'extension' => $this->_uploadedFile->getFileExtension(), 'size' => $a['size'], 'mime_type' => $a['type']), true); }