X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FImages.php;h=d7a58b52aa7faeaf3a275488412c4139405a80e8;hb=093dd70e790def206d6f7d48cfac095c29eb10a5;hp=3b07aee2fca1399e35bc6a994ed3459d70b2ce46;hpb=2647514603852fe5fb9f47f0bf153dd20c124ce6;p=friendica.git diff --git a/src/Util/Images.php b/src/Util/Images.php index 3b07aee2fc..d7a58b52aa 100644 --- a/src/Util/Images.php +++ b/src/Util/Images.php @@ -1,6 +1,6 @@ get($url); + $cacheKey = 'getInfoFromURL:' . sha1($url); + + $data = DI::cache()->get($cacheKey); if (empty($data) || !is_array($data)) { $data = self::getInfoFromURL($url); - DI::cache()->set($url, $data); + DI::cache()->set($cacheKey, $data); } return $data; @@ -185,14 +211,15 @@ class Images } if (Network::isLocalLink($url) && ($data = Photo::getResourceData($url))) { - $photo = Photo::getPhoto($data['guid'], $data['scale']); + $photo = Photo::selectFirst([], ['resource-id' => $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); + $img_str = DI::httpClient()->fetch($url, 4); } if (!$img_str) {