Skip to content

Commit

Permalink
Merge pull request #6027 from bolt/fix/not-just-strings
Browse files Browse the repository at this point in the history
Allow aliased thumbnails for image 'arrays'.
  • Loading branch information
GwendolenLynch committed Nov 11, 2016
2 parents 9374e48 + 3093003 commit e7771a6
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Twig/Handler/ImageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ private function getThumbnail($fileName = null, $width = null, $height = null, $
}

/**
* Get the thumbnail relative URI.
* Get the thumbnail relative URI, using width, height and action.
*
* @param Thumbnail $thumb
*
Expand All @@ -261,12 +261,25 @@ private function getThumbnailUri(Thumbnail $thumb)
);
}

/**
* Get the thumbnail relative URI, using an alias.
*
* @param mixed $filename
* @param string $alias
*
* @return mixed
*/
private function getAliasedUri($filename, $alias)
{
if (!$this->isAlias($alias)) {
return false;
}

// If we're passing in an image as array, instead of a single filename.
if (is_array($filename) && isset($filename['file'])) {
$filename = $filename['file'];
}

return $this->app['url_generator']->generate(
'thumb_alias',
[
Expand Down

0 comments on commit e7771a6

Please sign in to comment.