@param MediaInterface $media
@param string         $format
@param array          $options

@return string
541198
public function media($media, $format, $options = [])
    {
        $media = $this->getMedia($media);

        if (null === $media) {
            return '';
        }

        $provider = $this
            ->getMediaService()
            ->getProvider($media->getProviderName());

        $format = $provider->getFormatName($media, $format);

        $options = $provider->getHelperProperties($media, $format, $options);

        return $this->render($provider->getTemplate('helper_view'), [
            'media' => $media,
            'format' => $format,
            'options' => $options,
        ]);
    }
913230
public function getMediaFormatUrl(MediaInterface $media, $format)
    {
        /** @var DisplayMediaInterface $strategy */
        foreach ($this->strategies as $strategy) {
            if ($strategy->support($media)) {
                return $strategy->getMediaFormatUrl($media, $format);
            }
        }

        return $this->defaultStrategy->getMediaFormatUrl($media, $format);
    }
168870
public function format($format, array $data, $options)
    {
        $adapter = $this->getAdapter($format);

        return $adapter->format($data, $options);
    }
529741
protected function createSettingsFile($format, $options)
    {
        $SettingsClass = ($format === 'json') ? JsonSettings::class : YamlSettings::class;

        $filename = $this->exampleSettingsExists($format) ?
            "{$this->basePath}/Homestead.{$format}.example" :
            __DIR__."/../resources/Homestead.{$format}";

        $settings = $SettingsClass::fromFile($filename);

        if (! $this->exampleSettingsExists($format)) {
            $settings->updateName($options['name'])
                ->updateHostname($options['hostname']);
        }

        $settings->updateIpAddress($options['ip'])
            ->configureSites($this->projectName, $this->defaultProjectName)
            ->configureSharedFolders($this->basePath, $this->defaultProjectName)
            ->save("{$this->basePath}/Homestead.{$format}");
    }
1192483
public function thumbnail($media, $format, $options = [])
    {
        if (!$media) {
            return '';
        }

        $provider = $this->getProvider($media);

        $format = $provider->getFormatName($media, $format);
        $formatDefinition = $provider->getFormat($format);

        // build option
        $options = array_merge([
            'title' => $media->getName(),
            'width' => $formatDefinition['width'],
        ], $options);

        $options['src'] = $provider->generatePublicUrl($media, $format);

        return $this->getTemplating()->render($provider->getTemplate('helper_thumbnail'), [
            'media' => $media,
            'options' => $options,
        ]);
    }
1155622
public function renderImage(ImageInterface $image, $filter, array $options = array())
    {
        return
            $this->container->get('templating')
                ->render('ThraceMediaBundle:Media:image.html.twig',
                   array('image' => $image, 'filter' => $filter, 'options' => $options)
                )
            ;
    }
1060236
private function getFormat(array $options)
    {
        if (isset($options[self::PARAM_FORMAT])) {
            return $options[self::PARAM_FORMAT];
        } else {
            return $this->defaultFormat;
        }
    }
817179
protected function generateImage(string $format): string
    {
        $url = $this->generateUrl($format);

        $content = file_get_contents($url);

        if ($content === false) {
            $content = '';
        }

        return $content;
    }
599061
public function apply(TranscodeInterface $media, FormatInterface $format)
	{
		$this->filters = new \SplPriorityQueue();
		$this->addFilter(new SimpleFilter([
			'filter:v' => [
				'overlay' => urldecode(http_build_query([
					'x' => $this->getX(),
					'y' => $this->getY(),
				], null, ':'))
			]
		]));
		
		return parent::apply($media, $format);
	}
643349
public function getHtml(MediaInterface $media, $alias = null)
    {
        if ($media->getType() == $media::IMAGE) {
            $template = 'ApoutchikaMediaBundle:Render:image.html.twig';
        } elseif ($media->getType() == $media::VIDEO) {
            $template = 'ApoutchikaMediaBundle:Render:video.html.twig';
        } elseif ($media->getType() == $media::AUDIO) {
            $template = 'ApoutchikaMediaBundle:Render:audio.html.twig';
        } else {
            $template = 'ApoutchikaMediaBundle:Render:other.html.twig';
        }

        return $this->container->get('templating')->render($template, array(
            'media' => $media,
            'alias' => $alias,
            'url' => $this->getAbsoluteUrl($media, $alias),
        ));
    }
788180
public function runAdditionalProcess(MediaInterface $media, FormInterface $form)
    {
        foreach ($this->strategies as $strategy) {
            if ($strategy->support($media)) {
                return $strategy->runAdditionalProcess($media, $form);
            }
        }

        return $this->defaultStrategy->runAdditionalProcess($media, $form);
    }
47651
public function media($media, $format, $options = [])
    {
        if (!$media) {
            return '';
        }

        $provider = $this->getProvider($media);

        $format = $provider->getFormatName($media, $format);

        $options = $provider->getHelperProperties($media, $format, $options);

        return $this->templating->render($provider->getTemplate('helper_view'), [
             'media' => $media,
             'format' => $format,
             'options' => $options,
        ]);
    }
527780
public function apply(TranscodeInterface $media, FormatInterface $format)
	{
		if ( ! $format instanceof FrameFormatInterface)
		{
			throw new \InvalidArgumentException('The filter resize can be used only with the format of the frame.');
		}
		
		$format = $media->getFormat();
		$dimension = new Dimension($format->getWidth(), $format->getHeight());
		
		if ($this->width && ! $this->height) // Resize to width
		{
			$this->height = $this->width / $dimension->getRatio();
		}
		
		if ( ! $this->width && $this->height) // Resize to height
		{
			$this->width = $this->height * $dimension->getRatio();
		}
		
		// If the dimensions are the same, there's no need to resize.
		if($dimension->getWidth() === $this->width && $dimension->getHeight() === $this->height)
		{
			return [];
		}
		
		return [
			'filter:v' => [
				'scale' => http_build_query([
					'w' => $this->width,
					'h' => $this->height
				], null, ':')
			]
		];
	}
528053
public function to($format, array $options = []) {
		$this->offsetGet(null);
		return parent::to($format, $options);
	}
926112
public function generateAlternatives(MediaInterface $media)
    {
        if ($media->getFilesystemName() != '') {
            $filePath = $this->tmpDir . DIRECTORY_SEPARATOR . $media->getFilesystemName();
            $this->fileSystem->remove(array($filePath));
        }
    }
1245372
protected function generateAlternative($fileName, $formatName, array $formatSize)
    {
        $alternativeName = '';
        $alternativePath = $this->imageManager->generateAlternative(
            $this->tmpDir . DIRECTORY_SEPARATOR . $fileName,
            $formatSize
        );

        if ($alternativePath != '') {
            $alternativeName = $this->generateAlternativeName($formatName, $fileName);
            $this->mediaStorageManager->uploadFile($alternativeName, $alternativePath);
        }

        return $alternativeName;
    }
427146
public function toContent($contents, $format, $options = array())
	{
		if (!($contents instanceof Registry))
		{
			$contents = new Registry($contents);
		}

		return $contents->toString($format, $options);
	}