use Friendica\Core\Storage\Type\ExternalResource;
use Friendica\Core\Storage\Type\SystemResource;
use Friendica\Model\User;
+use Friendica\Network\HTTPClient\Client\HttpClient;
use Friendica\Network\HTTPException;
use Friendica\Network\HTTPException\NotModifiedException;
use Friendica\Object\Image;
}
}
- If (($contact['uid'] != 0) && empty($contact['photo']) && empty($contact['avatar'])) {
+ if (!empty($contact['uid']) && empty($contact['photo']) && empty($contact['avatar'])) {
$contact = Contact::getByURL($contact['url'], false, ['avatar', 'photo', 'xmpp', 'addr']);
}
+
if (!empty($contact['photo']) && !empty($contact['avatar'])) {
// Fetch photo directly
$resourceid = MPhoto::ridFromURI($contact['photo']);
}
$mimetext = '';
if (!empty($url)) {
- $mime = ParseUrl::getContentType($url);
+ $mime = ParseUrl::getContentType($url, HttpClient::ACCEPT_IMAGE);
if (!empty($mime)) {
$mimetext = $mime[0] . '/' . $mime[1];
} else {
if (!empty($mimetext) && ($mime[0] != 'image') && ($mimetext != 'application/octet-stream')) {
Logger::info('Unexpected Content-Type', ['mime' => $mimetext, 'url' => $url]);
$mimetext = '';
+ } if (!empty($mimetext)) {
+ Logger::debug('Expected Content-Type', ['mime' => $mimetext, 'url' => $url]);
}
}
if (empty($mimetext)) {