X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FImages.php;h=bf84ee6c22552bad74d3db1eb83272a5bc52f0d3;hb=0cafa871f1611f283a0f22ec3bb4e3c610028afc;hp=9e3be4f4f902f3425c38cf8ddf05b1a453898756;hpb=5344efef71f3a2978d50f1cf24771df28afc5aaa;p=friendica.git diff --git a/src/Util/Images.php b/src/Util/Images.php index 9e3be4f4f9..bf84ee6c22 100644 --- a/src/Util/Images.php +++ b/src/Util/Images.php @@ -1,6 +1,6 @@ $data['guid'], 'scale' => $data['scale']]); + if (!empty($photo)) { + $img_str = Photo::getImageDataForPhoto($photo); + } + // @todo Possibly add a check for locally stored files + } + + if (empty($img_str)) { + $img_str = DI::httpRequest()->fetch($url, 4); + } if (!$img_str) { return []; @@ -194,18 +203,7 @@ class Images $filesize = strlen($img_str); try { - if (function_exists("getimagesizefromstring")) { - $data = @getimagesizefromstring($img_str); - } else { - $tempfile = tempnam(get_temppath(), "cache"); - - $stamp1 = microtime(true); - file_put_contents($tempfile, $img_str); - DI::profiler()->saveTimestamp($stamp1, "file", System::callstack()); - - $data = getimagesize($tempfile); - unlink($tempfile); - } + $data = @getimagesizefromstring($img_str); } catch (\Exception $e) { return []; }