Skip to content

Commit 6c26acf

Browse files
committed
Merge pull request #146 from stevecoug/master
Issue #145 - OEmbed doesn't handle returned arrays of images
2 parents 09319dc + 0567deb commit 6c26acf

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/Providers/OEmbed.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,15 @@ public function getImagesUrls()
183183
$images[] = $this->bag->get('url');
184184
}
185185

186-
if ($this->bag->has('image')) {
187-
$images[] = $this->bag->get('image');
188-
}
189-
190-
if ($this->bag->has('thumbnail')) {
191-
$images[] = $this->bag->get('thumbnail');
192-
}
193-
194-
if ($this->bag->has('thumbnail_url')) {
195-
$images[] = $this->bag->get('thumbnail_url');
186+
foreach ([ 'image', 'thumbnail', 'thumbnail_url' ] as $type) {
187+
if ($this->bag->has($type)) {
188+
$ret = $this->bag->get($type);
189+
if (is_array($ret)) {
190+
$images = array_merge($images, $ret);
191+
} else {
192+
$images[] = $ret;
193+
}
194+
}
196195
}
197196

198197
return $images;

0 commit comments

Comments
 (0)