use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Item;
-use Friendica\Network\HTTPClient\Client\HttpClientAccept;
use Friendica\Network\HTTPException;
use Friendica\Network\Probe;
use Friendica\Protocol\ActivityNamespace;
$apcontact['photo'] = JsonLD::fetchElement($compacted, 'as:icon', '@id');
if (is_array($apcontact['photo']) || !empty($compacted['as:icon']['as:url']['@id'])) {
$apcontact['photo'] = JsonLD::fetchElement($compacted['as:icon'], 'as:url', '@id');
+ } elseif (empty($apcontact['photo'])) {
+ $photo = JsonLD::fetchElementArray($compacted, 'as:icon', 'as:url');
+ if (!empty($photo[0]['@id'])) {
+ $apcontact['photo'] = $photo[0]['@id'];
+ }
}
$apcontact['header'] = JsonLD::fetchElement($compacted, 'as:image', '@id');
}
if (empty($img_str)) {
- $img_str = DI::httpClient()->fetch($url, HttpClientAccept::IMAGE, 4);
+ try {
+ $img_str = DI::httpClient()->fetch($url, HttpClientAccept::IMAGE, 4);
+ } catch (\Exception $exception) {
+ Logger::notice('Image is invalid', ['url' => $url, 'exception' => $exception]);
+ return [];
+ }
}
if (!$img_str) {