Add the file size to the photo data array
This commit is contained in:
parent
a357ebd101
commit
33c0aba5b7
1 changed files with 5 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue