Esempio n. 1
0
 /**
  * Save uploaded file into database and on disk
  *
  * @param IFileUpload $uploadedFile
  * @return mixed
  */
 public function saveUploaded(IFileUpload $uploadedFile)
 {
     if ($uploadedFile->isImage()) {
         $file = self::imageObjectBuilder();
     } else {
         $file = self::fileObjectBuilder();
     }
     /** @var IFile $file */
     $file->fillFileUpload($uploadedFile);
     $this->databaseStorage->store($file);
     return $file;
 }
Esempio n. 2
0
 public function fillFileUpload(IFileUpload $fileUpload)
 {
     $this->name = $fileUpload->getName();
     $this->size = $fileUpload->getSize();
     $this->content_type = $fileUpload->getContentType();
     $this->is_image = $fileUpload->isImage();
     if (is_null($this->UID)) {
         $this->generateUID();
     }
     $fullPath = $this->storage_path . DIRECTORY_SEPARATOR . $this->UID;
     $fileUpload->moveTo($fullPath);
     $this->full_path = $fullPath;
 }
Esempio n. 3
0
 public function fillFileUpload(IFileUpload $fileUpload)
 {
     $this->name = $fileUpload->getName();
     $this->size = $fileUpload->getSize();
     $this->content_type = $fileUpload->getContentType();
     $this->is_image = true;
     if (is_null($this->UID)) {
         $this->generateUID();
     }
     $fullPath = $this->storage_path . DIRECTORY_SEPARATOR . $this->UID;
     $fileUpload->moveTo($fullPath);
     $this->full_path = $fullPath;
     $image = self::createResource($fullPath);
     $this->setImageResource($image);
     imagesavealpha($image, TRUE);
 }