From b1dd38f880d843dad92f0d76838edd40f1bf687b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 13 Aug 2019 12:39:21 +0300 Subject: add DiskCache.getUrl() and use it in a bunch of places --- include/functions.php | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'include/functions.php') diff --git a/include/functions.php b/include/functions.php index 80ae3fe7e..b63f8725e 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1258,20 +1258,7 @@ if (file_exists($cached_filename)) { - // this is strictly cosmetic - if ($entry->tagName == 'img') { - $suffix = ".png"; - } else if ($entry->parentNode && $entry->parentNode->tagName == "picture") { - $suffix = ".png"; - } else if ($entry->parentNode && $entry->parentNode->tagName == "video") { - $suffix = ".mp4"; - } else if ($entry->parentNode && $entry->parentNode->tagName == "audio") { - $suffix = ".ogg"; - } else { - $suffix = ""; - } - - $src = get_self_url_prefix() . '/public.php?op=cached_url&hash=' . sha1($src) . $suffix; + $src = DiskCache::getUrl(sha1($src)); if ($entry->hasAttribute('poster')) $entry->setAttribute('poster', $src); -- cgit v1.2.3