Detection of local requests

This commit is contained in:
Michael 2021-07-19 06:14:14 +00:00
parent 01abea7c25
commit 2647514603
3 changed files with 36 additions and 13 deletions

View 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,16 @@ class Images
return $data;
}
$img_str = DI::httpRequest()->fetch($url, 4);
if (Network::isLocalLink($url) && ($data = Photo::getResourceData($url))) {
$photo = Photo::getPhoto($data['guid'], $data['scale']);
if (!empty($photo)) {
$img_str = Photo::getImageDataForPhoto($photo);
}
}
if (empty($img_str)) {
$img_str = DI::httpRequest()->fetch($url, 4);
}
if (!$img_str) {
return [];