From cb77f46e9f0ab1b13ff74edb01d5de609e28535b Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 30 Dec 2012 22:59:12 +0100 Subject: [PATCH] privacy_image_cache: When a picture can't be retrieved after 10 seconds then show a blank picture --- privacy_image_cache/privacy_image_cache.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/privacy_image_cache/privacy_image_cache.php b/privacy_image_cache/privacy_image_cache.php index d98c6b6d..0e241e7e 100644 --- a/privacy_image_cache/privacy_image_cache.php +++ b/privacy_image_cache/privacy_image_cache.php @@ -128,7 +128,8 @@ function privacy_image_cache_init() { if (strpos($_REQUEST['url'], ".fbcdn.net/") and (substr($_REQUEST['url'], -6) == "_s.jpg")) $_REQUEST['url'] = substr($_REQUEST['url'], 0, -6)."_n.jpg"; - $img_str = fetch_url($_REQUEST['url'],true); + $redirects = 0; + $img_str = fetch_url($_REQUEST['url'],true, $redirects, 10); $tempfile = tempnam(get_config("system","temppath"), "cache"); file_put_contents($tempfile, $img_str); @@ -141,9 +142,9 @@ function privacy_image_cache_init() { $mime = "image/png"; $cachefile = ""; // Clear the cachefile so that the dummy isn't stored $valid = false; - $img = new Photo($img_str); + $img = new Photo($img_str, "image/png"); if($img->is_valid()) { - $img->scaleImage(1); + $img->scaleImage(10); $img_str = $img->imageString(); } //} else if (substr($img_str, 0, 6) == "GIF89a") {