From 33c0aba5b7518b4bd60ed4250658633d1f855e8b Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Wed, 31 Dec 2014 15:44:32 +0100 Subject: [PATCH] Add the file size to the photo data array --- include/Photo.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/Photo.php b/include/Photo.php index 580fd25b6..2f7c99025 100644 --- a/include/Photo.php +++ b/include/Photo.php @@ -764,11 +764,16 @@ function get_photo_info($url) { if (is_null($data)) { $img_str = fetch_url($url, true, $redirects, 4); + $filesize = strlen($img_str); + $tempfile = tempnam(get_temppath(), "cache"); file_put_contents($tempfile, $img_str); $data = getimagesize($tempfile); unlink($tempfile); + if ($data) + $data["size"] = $filesize; + Cache::set($url, serialize($data)); } else $data = unserialize($data);