Skip to content

Commit a744595

Browse files
committed
Merge branch 'master' of github.com:oscarotero/Embed
2 parents 109c16e + 778eb8e commit a744595

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

Embed/FastImage.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public function __construct ($uri = null) {
2929
}
3030

3131

32-
public function load ($uri) {
32+
public function load($uri)
33+
{
3334
if ($this->handle) {
3435
$this->close();
3536
}

Embed/Providers/OpenGraph.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,27 @@ public function __construct (Url $Url) {
1414
return false;
1515
}
1616

17+
$images = array();
18+
1719
foreach ($Html->getElementsByTagName('meta') as $Tag) {
1820
if ($Tag->hasAttribute('property') && (strpos($Tag->getAttribute('property'), 'og:') === 0)) {
19-
$this->set(substr($Tag->getAttribute('property'), 3), $Tag->getAttribute('content') ?: $Tag->getAttribute('value'));
21+
$name = substr($Tag->getAttribute('property'), 3);
22+
} else if ($Tag->hasAttribute('name') && (strpos($Tag->getAttribute('name'), 'og:') === 0)) {
23+
$name = substr($Tag->getAttribute('name'), 3);
24+
} else {
2025
continue;
2126
}
2227

23-
if ($Tag->hasAttribute('name') && (strpos($Tag->getAttribute('name'), 'og:') === 0)) {
24-
$this->set(substr($Tag->getAttribute('name'), 3), $Tag->getAttribute('content') ?: $Tag->getAttribute('value'));
28+
$value = $Tag->getAttribute('content') ?: $Tag->getAttribute('value');
29+
30+
if ($name === 'image') {
31+
$images[] = $value;
32+
} else {
33+
$this->set($name, $value);
2534
}
2635
}
36+
37+
$this->set('image', $images);
2738
}
2839

2940
public function getTitle () {

0 commit comments

Comments
 (0)