From 0567deb9430ef4ef7cb42983e54e96cd3de06bc1 Mon Sep 17 00:00:00 2001 From: Steve Meyers Date: Tue, 24 May 2016 16:08:45 -0600 Subject: [PATCH] Issue #145 - OEmbed doesn't handle returned arrays of images --- src/Providers/OEmbed.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Providers/OEmbed.php b/src/Providers/OEmbed.php index d47a75b2..3ac1ddec 100644 --- a/src/Providers/OEmbed.php +++ b/src/Providers/OEmbed.php @@ -183,16 +183,15 @@ public function getImagesUrls() $images[] = $this->bag->get('url'); } - if ($this->bag->has('image')) { - $images[] = $this->bag->get('image'); - } - - if ($this->bag->has('thumbnail')) { - $images[] = $this->bag->get('thumbnail'); - } - - if ($this->bag->has('thumbnail_url')) { - $images[] = $this->bag->get('thumbnail_url'); + foreach ([ 'image', 'thumbnail', 'thumbnail_url' ] as $type) { + if ($this->bag->has($type)) { + $ret = $this->bag->get($type); + if (is_array($ret)) { + $images = array_merge($images, $ret); + } else { + $images[] = $ret; + } + } } return $images;