Skip to content

Commit

Permalink
Fix bug with thumbnail path when thumbnail is not set.
Browse files Browse the repository at this point in the history
  • Loading branch information
nilov committed May 3, 2018
1 parent 63f8418 commit ed04448
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions Util/MediaStructure.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,19 @@ public function getMediaStructure(MediaInterface $media, $thumbnailFilter = null
{
$contentPath = $this->mediaHelper->getContentPath($media, $isAbsolute);

if ($thumbnailFilter) {
if (!$this->imagineHelper instanceof ImagineHelper) {
throw new Exception('ImagineHelper is not defined. You need use Liip\ImagineBundle.');
}
$thumbnailPath = null;
if ($media->getThumbnailPath()) {
if ($thumbnailFilter) {
if (!$this->imagineHelper instanceof ImagineHelper) {
throw new Exception('ImagineHelper is not defined. You need use Liip\ImagineBundle.');
}

$thumbnailPath = $this->mediaHelper->getThumbnailPath($media, false);
$thumbnailPath = $this->imagineHelper->filter($thumbnailPath, $thumbnailFilter);
$thumbnailPath = $this->mediaHelper->getThumbnailPath($media, false);
$thumbnailPath = $this->imagineHelper->filter($thumbnailPath, $thumbnailFilter);

} else {
$thumbnailPath = $this->mediaHelper->getThumbnailPath($media, $isAbsolute);
} else {
$thumbnailPath = $this->mediaHelper->getThumbnailPath($media, $isAbsolute);
}
}

return [
Expand Down

0 comments on commit ed04448

Please sign in to comment.