summaryrefslogtreecommitdiff
path: root/include/rssfuncs.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-02-04 11:50:01 +0300
committerAndrew Dolgov <[email protected]>2017-02-04 11:50:01 +0300
commit5edd605ae1a9269b8b6b91b587da3d54a35424e9 (patch)
tree80a6354dc99e4652b1cd6ee988d2c9b7f6cc7137 /include/rssfuncs.php
parent0442cbb6c16e22cf172ade58d675c1e2001646d1 (diff)
image cache: do not try to cache data: schema urls; add caching of html5 video content (similar to cache_starred_images plugin)
Diffstat (limited to 'include/rssfuncs.php')
-rw-r--r--include/rssfuncs.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/rssfuncs.php b/include/rssfuncs.php
index fd4a10f13..1f38091b6 100644
--- a/include/rssfuncs.php
+++ b/include/rssfuncs.php
@@ -1239,13 +1239,14 @@
$doc->loadHTML($charset_hack . $html);
$xpath = new DOMXPath($doc);
- $entries = $xpath->query('(//img[@src])');
+ $entries = $xpath->query('(//img[@src])|(//video/source[@src])');
foreach ($entries as $entry) {
- if ($entry->hasAttribute('src')) {
+ if ($entry->hasAttribute('src') && strpos($entry->getAttribute('src'), "data:") !== 0) {
$src = rewrite_relative_url($site_url, $entry->getAttribute('src'));
- $local_filename = CACHE_DIR . "/images/" . sha1($src) . ".png";
+ $extension = $entry->tagName == 'source' ? '.mp4' : '.png';
+ $local_filename = CACHE_DIR . "/images/" . sha1($src) . $extension;
if ($debug) _debug("cache_images: downloading: $src to $local_filename");