Sulu\Bundle\MediaBundle\Media\FormatCache\LocalFormatCache::getMediaUrl PHP Method

getMediaUrl() public method

public getMediaUrl ( $id, $fileName, $options, $format, $version, $subVersion )
    public function getMediaUrl($id, $fileName, $options, $format, $version, $subVersion)
    {
        return $this->getPathUrl($this->pathUrl, $id, $fileName, $format, $version, $subVersion);
    }

Usage Example

Example #1
0
 /**
  * testMediaUrlEncoding.
  */
 public function testMediaUrlEncoding()
 {
     $version = 2;
     $fileId = 1;
     $segment = $fileId % $this->segments;
     $format = '50x50';
     $fileName = 'Test With Spaces & Co.jpg';
     $filePath = $this->localStorage->getMediaUrl($fileId, $fileName, [], $format, $version);
     $encodedFileName = 'Test%20With%20Spaces%20%26%20Co.jpg';
     $this->assertSame('/uploads/media/50x50/01/1-Test%20With%20Spaces%20%26%20Co.jpg?v=2', $filePath);
 }