From 68e2b05f657dca2a389cb9d585215c126e5da290 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 14 Aug 2019 16:55:38 +0300 Subject: * move get_article_image to Article; implement better og:image detection (similar to android app) * pass article image to API clients in headlines row object --- classes/api.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'classes/api.php') diff --git a/classes/api.php b/classes/api.php index 45e4d3062..0c5c30135 100755 --- a/classes/api.php +++ b/classes/api.php @@ -759,9 +759,10 @@ class API extends Handler { "tags" => $tags, ); + $enclosures = Article::get_article_enclosures($line['id']); + if ($include_attachments) - $headline_row['attachments'] = Article::get_article_enclosures( - $line['id']); + $headline_row['attachments'] = $enclosures; if ($show_excerpt) $headline_row["excerpt"] = $line["content_preview"]; @@ -801,7 +802,8 @@ class API extends Handler { $headline_row = $p->hook_render_article_api(array("headline" => $headline_row)); } - $headline_row['content'] = DiskCache::rewriteUrls($headline_row['content']); + $headline_row["content"] = DiskCache::rewriteUrls($headline_row['content']); + $headline_row["flavor_image"] = Article::get_article_image($enclosures, $line["content"], $line["site_url"]); array_push($headlines, $headline_row); } -- cgit v1.2.3