Skip to content

Commit 62a90e2

Browse files
committed
Fixed image detection in Html provider
1 parent b5342e6 commit 62a90e2

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Embed/Providers/Html.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,12 @@ public function __construct(Url $Url)
128128

129129
foreach ($Content->getElementsByTagName('img') as $Tag) {
130130
if ($Tag->hasAttribute('src')) {
131-
$image = $Tag->getAttribute('src');
131+
$image = new Url($Tag->getAttribute('src'));
132132

133133
//Check whether the image is in the same domain
134-
if ((strpos($image, '//') === false) || (($ImgUrl = new Url($image)) && ($ImgUrl->getDomain() !== $domain))) {
135-
continue;
134+
if (!$image->getDomain() || $image->getDomain() === $domain) {
135+
$images[] = $image->getUrl();
136136
}
137-
138-
$images[] = $image;
139137
}
140138
}
141139

0 commit comments

Comments
 (0)