public function process(ThingInterface $thing, $sourcePath, OptionsInterface $options = null)
    {
        $image = $this->imagine->open($sourcePath);

        $options = $this->defaults->merge($options);

        $width  = $options->getWidth();
        $height = $options->getHeight();

        $size = new Box($width, $height);

        $transformation = $this->getTransformation($image, $size, $options);

        $tmpPath = $this->tmpFs->createTemporaryFile();
        $transformation->save(
            $tmpPath,
            [
                'format'  => $options->getFormat(),
                'quality' => $options->getQuality()
            ]
        );

        try {
            $transformation->apply($image);
        } catch (\Exception $e) {
            throw new ProcessingFailedException('Failed to create image: '.$e->getMessage());
        }

        return [$tmpPath];
    }
public function process(ThingInterface $thing, $sourcePath, OptionsInterface $options = null)
    {
        $image = $this->imagine->open($sourcePath);

        $options = $this->defaults->merge($options);

        $width  = $options->getWidth();
        $height = $options->getHeight();

        $size = new Box($width, $height);

        $transformation = $this->getTransformation($image, $size, $options);

        $tmpPath = $this->tmpFs->createTemporaryFile();
        $transformation->save(
            $tmpPath,
            [
                'format'  => $options->getFormat(),
                'quality' => $options->getQuality()
            ]
        );

        try {
            $transformation->apply($image);
        } catch (\Exception $e) {
            throw new ProcessingFailedException('Failed to create image: '.$e->getMessage());
        }

        return [$tmpPath];
    }
@param ThingInterface   $thing
@param string           $sourcePath
@param OptionsInterface $options

@return array Paths to generated files
@throws ProcessingFailedException