Add the file size to the photo data array

This commit is contained in:
Michael Vogel 2014-12-31 15:44:32 +01:00
parent a357ebd101
commit 33c0aba5b7

View file

@ -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);