Example #1
0
 /**
  * Upload image
  *
  * @param ImageInterface $image   Image entity
  * @param string         $path    Image source path
  * @param array          $options Upload options
  *
  * @return ImageInterface
  */
 public function upload(ImageInterface $image, $path, array $options = [])
 {
     $itemLength = $this->adapter->directoryLength($this->fileSystem->getCurrentDirectory());
     $image = $this->fileSystem->hydrateImageInfo($image, $path);
     $destination = $this->fileSystem->defineImagePath($image, $itemLength);
     $this->adapter->upload($path, $destination, $options);
     $image->setPath($destination);
     return $image;
 }