From ffb842f752b9208fd5bb7479b3d189d261f7170f Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 14 Aug 2019 17:21:07 +0300 Subject: [PATCH] Article::get_article_image() - provide cached URLs if possible --- classes/article.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/classes/article.php b/classes/article.php index 789d4c577..02477b553 100755 --- a/classes/article.php +++ b/classes/article.php @@ -875,6 +875,14 @@ class Article extends Handler_Protected { } } + $cache = new DiskCache("images"); + + if ($cache->exists(sha1($article_image))) + $article_image = $cache->getUrl(sha1($article_image)); + + if ($cache->exists(sha1($article_stream))) + $article_stream = $cache->getUrl(sha1($article_stream)); + return [$article_image, $article_stream]; }