network: Caching of images

This commit is contained in:
Michael Vogel 2012-07-26 00:23:25 +02:00
parent 6456c2484e
commit fc27edb6d7

View File

@ -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);