get() public method

Return a service which transforms an image.
public get ( string $name ) : Sulu\Bundle\MediaBundle\Media\ImageConverter\Transformation\TransformationInterface
$name string
return Sulu\Bundle\MediaBundle\Media\ImageConverter\Transformation\TransformationInterface
Example #1
0
 /**
  * Applies an array of transformations on a passed image.
  *
  * @param ImageInterface $image
  * @param $tansformations
  *
  * @throws ImageProxyInvalidFormatOptionsException
  *
  * @return ImageInterface The modified image
  */
 private function applyTransformations(ImageInterface $image, $tansformations)
 {
     foreach ($tansformations as $transformation) {
         if (!isset($transformation['effect'])) {
             throw new ImageProxyInvalidFormatOptionsException('Effect not found');
         }
         $image = $this->modifyAllLayers($image, function (ImageInterface $layer) use($transformation) {
             return $this->transformationPool->get($transformation['effect'])->execute($layer, $transformation['parameters']);
         });
     }
     return $image;
 }