diff options
author | Andrew Dolgov <[email protected]> | 2019-01-14 15:58:14 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2019-01-14 15:58:14 +0300 |
commit | 70d9c7849a27d313a08bfbb7676ce16a5a2f2b4a (patch) | |
tree | eac1dcc4f46aadfe99c7ae75aed30d68e886db5e /classes/handler | |
parent | fd28d548ad8f808a735441bb80b19fce7adee775 (diff) | |
parent | b1f9ebe46e5d3ee6894958133819106d43b1411e (diff) |
Merge branch 'master' of git.fakecake.org:tt-rss
Diffstat (limited to 'classes/handler')
-rwxr-xr-x | classes/handler/public.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/classes/handler/public.php b/classes/handler/public.php index 274936c33..235aba3c6 100755 --- a/classes/handler/public.php +++ b/classes/handler/public.php @@ -323,8 +323,7 @@ class Handler_Public extends Handler { foreach ($enclosures as $enc) { if (strpos($enc["content_type"], "image/") !== FALSE) { - $og_image = $enc["content_url"]; - break; + return rewrite_relative_url($site_url, $enc["content_url"]); } } @@ -333,15 +332,18 @@ class Handler_Public extends Handler { if (@$tmpdoc->loadHTML(mb_substr($content, 0, 131070))) { $tmpxpath = new DOMXPath($tmpdoc); - $first_img = $tmpxpath->query("//img")->item(0); + $imgs = $tmpxpath->query("//img"); + + foreach ($imgs as $img) { + $src = $img->getAttribute("src"); - if ($first_img) { - $og_image = $first_img->getAttribute("src"); + if (mb_strpos($src, "data:") !== 0) + return rewrite_relative_url($site_url, $src); } } } - return rewrite_relative_url($site_url, $og_image); + return false; } private function format_article($id, $owner_uid) { |