getFormatOptions() public méthode

Get formatOptions.
public getFormatOptions ( ) : Doctrine\Common\Collections\Collection
Résultat Doctrine\Common\Collections\Collection
Exemple #1
0
 /**
  * {@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));
 }