From: Michael Vogel Date: Wed, 31 Dec 2014 14:44:32 +0000 (+0100) Subject: Add the file size to the photo data array X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=33c0aba5b7518b4bd60ed4250658633d1f855e8b;p=friendica.git Add the file size to the photo data array --- diff --git a/include/Photo.php b/include/Photo.php index 580fd25b6a..2f7c990256 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);