From fc27edb6d76765cd9b85d29a3c41f23f17c6ca41 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Thu, 26 Jul 2012 00:23:25 +0200 Subject: [PATCH] network: Caching of images --- include/network.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/network.php b/include/network.php index fd9999b539..0fff5c7cc9 100644 --- a/include/network.php +++ b/include/network.php @@ -823,6 +823,12 @@ function scale_external_images($s, $include_link = true, $scale_replace = false) $scaled = $mtch[1]; $i = fetch_url($scaled); + $cache = get_config('system','itemcache'); + if (($cache != '') and is_dir($cache)) { + $cachefile = $cache."/".hash("md5", $scaled); + file_put_contents($cachefile, $i); + } + // guess mimetype from headers or filename $type = guess_image_type($mtch[1],true); -- 2.39.5