getFormatOptions() public method

Get formatOptions.
public getFormatOptions ( ) : Doctrine\Common\Collections\Collection
return Doctrine\Common\Collections\Collection
コード例 #1
0
ファイル: ImagineImageConverter.php プロジェクト: sulu/sulu
 /**
  * {@inheritdoc}
  */
 public function convert(FileVersion $fileVersion, $formatKey)
 {
     $content = $this->storage->loadAsString($fileVersion->getName(), $fileVersion->getVersion(), $fileVersion->getStorageOptions());
     $extractedImage = $this->mediaImageExtractor->extract($content);
     try {
         $image = $this->imagine->load($extractedImage);
     } catch (RuntimeException $e) {
         throw new InvalidFileTypeException($e->getMessage());
     }
     $image = $this->toRGB($image);
     $format = $this->getFormat($formatKey);
     $cropParameters = $this->getCropParameters($image, $fileVersion->getFormatOptions()->get($formatKey), $this->formats[$formatKey]);
     if (isset($cropParameters)) {
         $image = $this->applyFormatCrop($image, $cropParameters);
     }
     if (isset($format['scale']) && $format['scale']['mode'] !== ImageInterface::THUMBNAIL_INSET) {
         $image = $this->applyFocus($image, $fileVersion, $format['scale']);
     }
     if (isset($format['scale'])) {
         $image = $this->applyScale($image, $format['scale']);
     }
     if (isset($format['transformations'])) {
         $image = $this->applyTransformations($image, $format['transformations']);
     }
     $image->strip();
     // Set Interlacing to plane for smaller image size.
     if (count($image->layers()) == 1) {
         $image->interlace(ImageInterface::INTERLACE_PLANE);
     }
     $imagineOptions = $format['options'];
     $imageExtension = $this->getImageExtension($fileVersion->getName());
     return $image->get($imageExtension, $this->getOptionsFromImage($image, $imageExtension, $imagineOptions));
 }