Exemplo n.º 1
0
 public function thumbate(FileUpload $file, Thumb $thumb)
 {
     /** @var $image Image */
     $image = $file->toImage();
     $dimension = $thumb->getDimension();
     // Resize to thumb dimension
     $image->resize($dimension->getWidth(), $dimension->getHeight(), $dimension->getFlag());
     // Image name
     $imagename = $thumb->getImagename();
     // File name
     $filename = $imagename . '.' . Utils::ext($file->name);
     // Gets properly directory
     $path = Utils::dirs($this->repository, $thumb->getPath(), $filename);
     // Store image data
     $this->images[] = ArrayHash::from(['path' => Utils::dirs($this->repository, $thumb->getPath()), 'fullpath' => $path, 'filename' => $filename, 'name' => $imagename, 'ext' => Utils::ext($file->name)]);
     // Save to file
     $image->save($path);
 }