Skip to content

Commit

Permalink
Patch image size
Browse files Browse the repository at this point in the history
  • Loading branch information
Ugo Sans H authored Feb 24, 2017
1 parent b0426c9 commit f0b61db
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function render(ImageInterface $image, array $attr = [])
*
* @return string
*/
public function renderWithouSize(ImageInterface $image, array $attr = [])
public function renderWithoutSize(ImageInterface $image, array $attr = [])
{
$attr = array_merge([
'src' => $image->getLink('url'),
Expand All @@ -133,6 +133,13 @@ public function renderWithouSize(ImageInterface $image, array $attr = [])
public function getImageTag($id, $width = null, $height = null, $crop = null, array $attr = [])
{
if ($image = $this->manager->getInfo($id, $width, $height, $crop)) {
if (is_null($width) && is_null($height)) {
$attr['src'] = $image->getLink('url');
$attr['alt'] = $image->getTitle();

return $this->generateTag($attr);
}

return $this->render($image, $attr);
}

Expand All @@ -156,7 +163,7 @@ public function getImageTag($id, $width = null, $height = null, $crop = null, ar
public function getImageTagNoSpecificSize($id)
{
if ($image = $this->manager->getInfo($id)) {
return $this->renderWithouSize($image);
return $this->renderWithoutSize($image);
}

$attr['src'] = $this->default;
Expand Down

0 comments on commit f0b61db

Please sign in to comment.