Ejemplo n.º 1
0
 /**
  * Creates a resized image.
  */
 public function create()
 {
     if (null === $this->image) {
         $sourceFilePath = Path::combine($this->sourceFileResourceType->getDirectory(), $this->sourceFileDir, $this->sourceFileName);
         if ($this->backend->isHiddenFile($this->sourceFileName) || !$this->backend->has($sourceFilePath)) {
             throw new FileNotFoundException('ResizedImage::create(): Source file not found');
         }
         $this->image = Image::create($this->backend->read($sourceFilePath));
     }
     $this->image->resize($this->width, $this->height);
     $this->resizedImageData = $this->image->getData();
     $this->resizedImageSize = $this->image->getDataSize();
     $this->resizedImageMimeType = $this->image->getMimeType();
 }