]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/Images.php
Use HTTPRequestOptions constants for HTTPClient::get()
[friendica.git] / src / Util / Images.php
index 7b11ea3f6b580e57286d33beab41c04c409c6153..bf84ee6c22552bad74d3db1eb83272a5bc52f0d3 100644 (file)
@@ -22,8 +22,8 @@
 namespace Friendica\Util;
 
 use Friendica\Core\Logger;
-use Friendica\Core\System;
 use Friendica\DI;
+use Friendica\Model\Photo;
 
 /**
  * Image utilities
@@ -184,7 +184,17 @@ class Images
                        return $data;
                }
 
-               $img_str = DI::httpRequest()->fetch($url, 4);
+               if (Network::isLocalLink($url) && ($data = Photo::getResourceData($url))) {
+                       $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);
+               }
 
                if (!$img_str) {
                        return [];