/** * {@inheritdoc} */ public function resize(MediaInterface $media, File $in, File $out, $format, array $settings) { if (!isset($settings['width'])) { throw new \RuntimeException(sprintf('Width parameter is missing in context "%s" for provider "%s"', $media->getContext(), $media->getProviderName())); } $image = $this->adapter->load($in->getContent()); $content = $image->thumbnail($this->getBox($media, $settings), $this->mode)->get($format, array('quality' => $settings['quality'])); $out->setContent($content, $this->metadata->get($media, $out->getName())); }
/** * {@inheritdoc} */ public function getReferenceFile(MediaInterface $media) { $key = $this->generatePrivateUrl($media, 'reference'); // the reference file is remote, get it and store it with the 'reference' format if ($this->getFilesystem()->has($key)) { $referenceFile = $this->getFilesystem()->get($key); } else { $referenceFile = $this->getFilesystem()->get($key, true); $metadata = $this->metadata ? $this->metadata->get($media, $referenceFile->getName()) : array(); $referenceFile->setContent($this->browser->get($this->getReferenceImage($media))->getContent(), $metadata); } return $referenceFile; }