From 7cebb53b3197da13cc6eeb93d687b16799b76cba Mon Sep 17 00:00:00 2001 From: Sebastian Pfahl Date: Sat, 22 May 2021 13:17:43 +0200 Subject: [PATCH 1/3] Add 'alt' param to getHtml function --- lib/Tmdb/Helper/ImageHelper.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Tmdb/Helper/ImageHelper.php b/lib/Tmdb/Helper/ImageHelper.php index f2ecd9d5..692d0402 100644 --- a/lib/Tmdb/Helper/ImageHelper.php +++ b/lib/Tmdb/Helper/ImageHelper.php @@ -57,9 +57,10 @@ public function getImageConfiguration() * @param string $size * @param int|null $width * @param int|null $height + * @param string $alt * @return string */ - public function getHtml($image, $size = 'original', $width = null, $height = null) + public function getHtml($image, $size = 'original', $width = null, $height = null, $alt = '') { if ($image instanceof Image) { if (null == $image->getFilePath()) { @@ -86,10 +87,11 @@ public function getHtml($image, $size = 'original', $width = null, $height = nul } return sprintf( - '', + '%s', $this->getUrl($image, $size), $width, - $height + $height, + $alt ); } From 28166c7778ac8abc4b5ac7f5a2113eb886cf16b0 Mon Sep 17 00:00:00 2001 From: Sebastian Pfahl Date: Sat, 22 May 2021 13:26:00 +0200 Subject: [PATCH 2/3] Also add title param --- lib/Tmdb/Helper/ImageHelper.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Tmdb/Helper/ImageHelper.php b/lib/Tmdb/Helper/ImageHelper.php index 692d0402..bb662527 100644 --- a/lib/Tmdb/Helper/ImageHelper.php +++ b/lib/Tmdb/Helper/ImageHelper.php @@ -57,10 +57,10 @@ public function getImageConfiguration() * @param string $size * @param int|null $width * @param int|null $height - * @param string $alt + * @param string $title * @return string */ - public function getHtml($image, $size = 'original', $width = null, $height = null, $alt = '') + public function getHtml($image, $size = 'original', $width = null, $height = null, $title = '') { if ($image instanceof Image) { if (null == $image->getFilePath()) { @@ -87,11 +87,12 @@ public function getHtml($image, $size = 'original', $width = null, $height = nul } return sprintf( - '%s', + '%s', $this->getUrl($image, $size), $width, $height, - $alt + $title, + $title ); } From 916dd74d57ef2837460cc4049a803b57d25df46b Mon Sep 17 00:00:00 2001 From: Sebastian Pfahl Date: Sat, 22 May 2021 13:29:33 +0200 Subject: [PATCH 3/3] Aplit alt and title objects parameter --- lib/Tmdb/Helper/ImageHelper.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Tmdb/Helper/ImageHelper.php b/lib/Tmdb/Helper/ImageHelper.php index bb662527..7dc2b79e 100644 --- a/lib/Tmdb/Helper/ImageHelper.php +++ b/lib/Tmdb/Helper/ImageHelper.php @@ -57,10 +57,11 @@ public function getImageConfiguration() * @param string $size * @param int|null $width * @param int|null $height + * @param string $alt * @param string $title * @return string */ - public function getHtml($image, $size = 'original', $width = null, $height = null, $title = '') + public function getHtml($image, $size = 'original', $width = null, $height = null, $alt = '', $title = '') { if ($image instanceof Image) { if (null == $image->getFilePath()) { @@ -92,7 +93,7 @@ public function getHtml($image, $size = 'original', $width = null, $height = nul $width, $height, $title, - $title + $alt ); }