Skip to content

Commit

Permalink
Fix thumbnail URL for reference format
Browse files Browse the repository at this point in the history
  • Loading branch information
NeuralClone authored and OskarStark committed Jan 5, 2016
1 parent 0f568b9 commit 57fd25e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Tests/Provider/ImageProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public function testProvider()
$this->assertSame('default/0011/24', $provider->generatePath($media));
$this->assertSame('/uploads/media/default/0011/24/thumb_1023456_big.png', $provider->generatePublicUrl($media, 'big'));
$this->assertSame('/uploads/media/default/0011/24/ASDASDAS.png', $provider->generatePublicUrl($media, 'reference'));

$this->assertEquals('default/0011/24/ASDASDAS.png', $provider->generatePrivateUrl($media, 'reference'));
$this->assertEquals('default/0011/24/thumb_1023456_big.png', $provider->generatePrivateUrl($media, 'big'));
}

public function testHelperProperies()
Expand Down
7 changes: 6 additions & 1 deletion Thumbnail/FormatThumbnail.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ public function generatePublicUrl(MediaProviderInterface $provider, MediaInterfa
*/
public function generatePrivateUrl(MediaProviderInterface $provider, MediaInterface $media, $format)
{
return sprintf('%s/thumb_%s_%s.%s',
if ('reference' === $format) {
return $provider->getReferenceImage($media);
}

return sprintf(
'%s/thumb_%s_%s.%s',
$provider->generatePath($media),
$media->getId(),
$format,
Expand Down

0 comments on commit 57fd25e

Please sign in to comment.