Article::get_article_image() - provide cached URLs if possible

This commit is contained in:
Andrew Dolgov 2019-08-14 17:21:07 +03:00
parent 150b040dad
commit ffb842f752
1 changed files with 8 additions and 0 deletions

View File

@ -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]; return [$article_image, $article_stream];
} }