Skip to content

Commit

Permalink
Fixed image detection in Html provider
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Mar 26, 2014
1 parent b5342e6 commit 62a90e2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Embed/Providers/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,12 @@ public function __construct(Url $Url)

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

//Check whether the image is in the same domain
if ((strpos($image, '//') === false) || (($ImgUrl = new Url($image)) && ($ImgUrl->getDomain() !== $domain))) {
continue;
if (!$image->getDomain() || $image->getDomain() === $domain) {
$images[] = $image->getUrl();
}

$images[] = $image;
}
}

Expand Down

0 comments on commit 62a90e2

Please sign in to comment.