1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-21 16:51:28 +00:00

remove local file extensions and generalize some method names for cached media

file extensions may still be present in urls, but are ignored by the backend

MIGRATION (if you have any cached data worth keeping, not required):
in cache/images run "rename 's/\..*$//' *" i.e. strip file extensions
This commit is contained in:
Andrew Dolgov
2017-03-23 14:55:40 +03:00
parent 63f0ed3d9c
commit 41bead9baa
4 changed files with 19 additions and 19 deletions

View File

@@ -913,11 +913,11 @@
// check cache only for video and images for the time being
if ($entry->nodeName == 'img' || ($entry->parentNode && $entry->parentNode->nodeName == "video")) {
$cached_filename = CACHE_DIR . '/images/' . sha1($src);
$extension = $entry->tagName == 'source' ? '.mp4' : '.png';
$cached_filename = CACHE_DIR . '/images/' . sha1($src) . $extension;
if (file_exists($cached_filename)) {
$src = get_self_url_prefix() . '/public.php?op=cached_image&hash=' . sha1($src) . $extension;
$src = get_self_url_prefix() . '/public.php?op=cached_url&hash=' . sha1($src) . $extension;
if ($entry->hasAttribute('srcset')) {
$entry->removeAttribute('srcset');