When a server isn't reachable there were timeout problems with fetching image data

This commit is contained in:
Michael Vogel 2016-01-18 15:38:38 +01:00
parent 135052a5a0
commit 5ec2c7e965
3 changed files with 18 additions and 10 deletions

View file

@ -792,15 +792,19 @@ function get_photo_info($url) {
$filesize = strlen($img_str);
$tempfile = tempnam(get_temppath(), "cache");
if (function_exists("getimagesizefromstring"))
$data = getimagesizefromstring($img_str);
else {
$tempfile = tempnam(get_temppath(), "cache");
$a = get_app();
$stamp1 = microtime(true);
file_put_contents($tempfile, $img_str);
$a->save_timestamp($stamp1, "file");
$a = get_app();
$stamp1 = microtime(true);
file_put_contents($tempfile, $img_str);
$a->save_timestamp($stamp1, "file");
$data = getimagesize($tempfile);
unlink($tempfile);
$data = getimagesize($tempfile);
unlink($tempfile);
}
if ($data)
$data["size"] = $filesize;