5 users online. Create an account or sign in to join them.Users
Caching External Images
This is an open discussion with 2 replies, filed under Troubleshooting.
Search
Thanks for posting it Makenosound
Yeah thanks for that! Much-o usefulness! :)
Create an account or sign in to comment.
I've been looking for a way of dealing with external images neatly in S2 and Alistair kindly helped me out by providing this addition to the
image.phpfile:## Cache the external images for 1 day (24 * 60 * 60) elseif($param['external'] == '1' && CACHING){ $cache_file = CACHE . '/' . md5($_REQUEST['param'] . $quality) . "_" . basename($image_path); if(@is_file($cache_file) && (@filemtime($cache_file) < (time() - (24 * 60 * 60)))){ unlink($cache_file); } elseif(is_file($cache_file)){ $image_path = $cache_file; @touch($cache_file); $param['mode'] = MODE_NONE; $param['external'] = 0; } }If you add that in around line 55 in
/symphony/image.phpexternal images called through the Symphony image function will be cached for 24 hours — the idea being that if you're using Flickr or similar to manage your external images, then you won't have to deal with the processing overhead from modifying each image on the fly each time. As an added bonus, if Flickr goes down during your cache period your images will still show up.