]> git.mxchange.org Git - friendica.git/commitdiff
network: Caching of images
authorMichael Vogel <icarus@dabo.de>
Wed, 25 Jul 2012 22:23:25 +0000 (00:23 +0200)
committerMichael Vogel <icarus@dabo.de>
Wed, 25 Jul 2012 22:23:25 +0000 (00:23 +0200)
include/network.php

index fd9999b53995e1e60579059c19a688129deccb19..0fff5c7cc9eea0993682da0810cc2748b4819e11 100644 (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);