Exemplo n.º 1
0
 /**
  * Set size of file, if it's image, set width and height.
  *
  * @param MediaInterface $media
  *
  * @return MediaInterface
  */
 public function setSizeWidthAndHeight(MediaInterface $media)
 {
     $key = $this->originalDir . '/' . $media->getReference();
     $media->setSize($this->filesystemManipulator->size($key));
     if ($media->getType() === $media::IMAGE) {
         $image = $this->imagine->load($this->filesystemManipulator->read($key));
         $size = $image->getSize();
         $media->setWidth($size->getWidth());
         $media->setHeight($size->getHeight());
     }
     return $this;
 }