Skip to content

Commit a4caca8

Browse files
committed
image detection improvements
1 parent 0be6d24 commit a4caca8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Embed/Providers/Html.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,18 @@ public function __construct(Request $request)
135135
if ($img->hasAttribute('src')) {
136136
$src = new Url($img->getAttribute('src'));
137137

138-
//Check whether the image is in the same domain
139-
if ($src->getDomain() && $src->getDomain() !== $domain) {
138+
//Is src relative?
139+
if (!$src->getDomain()) {
140+
$images[] = $src->getUrl();
140141
continue;
141142
}
142143

143-
//Check whether the image is inside an external link
144+
//Avoid external images
145+
if ($src->getDomain() !== $domain) {
146+
continue;
147+
}
148+
149+
//Avoid images in external links
144150
$parent = $img->parentNode;
145151

146152
while ($parent && isset($parent->tagName)) {

0 commit comments

Comments
 (0)