Skip to content

Commit

Permalink
fix(shownotes): handle image providers returning lists
Browse files Browse the repository at this point in the history
Some providers return a list of images. In these cases, take the first one.
  • Loading branch information
eteubert committed Oct 9, 2023
1 parent f954244 commit 6b27e3e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/modules/shownotes/template/entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public function icon()
* Open Graph image.
*
* @see image
*
* @accessor
*/
public function image()
Expand All @@ -124,6 +125,10 @@ public function image()

$image_url = $this->entry->image ?? $data['providers']['open_graph']['image'] ?? $data['providers']['twitter']['image:src'] ?? false;

if (is_array($image_url)) {
$image_url = $image_url[0];
}

if ($image_url) {
return new \Podlove\Template\Image((new \Podlove\Model\Image($image_url, $this->entry->title))->setWidth(1024));
}
Expand Down

0 comments on commit 6b27e3e

Please sign in to comment.