use Friendica\Util\DateTimeFormat;
use Friendica\Util\Images;
use Friendica\Security\Security;
+use Friendica\Util\Proxy;
use Friendica\Util\Strings;
require_once "include/dba.php";
$filename = basename($image_url);
if (!empty($image_url)) {
- $ret = DI::httpRequest()->get($image_url, true);
+ $ret = DI::httpRequest()->get($image_url);
$img_str = $ret->getBody();
- $contType = $ret->getContentType();
+ $type = $ret->getContentType();
} else {
$img_str = '';
- $contType = '';
}
if ($quit_on_error && ($img_str == "")) {
return false;
}
- $type = Images::getMimeTypeByData($img_str, $image_url, $contType);
+ $type = Images::getMimeTypeByData($img_str, $image_url, $type);
$Image = new Image($img_str, $type);
if ($Image->isValid()) {
}
if ($photo_failure) {
- $image_url = DI::baseUrl() . Contact::DEFAULT_AVATAR_PHOTO;
- $thumb = DI::baseUrl() . Contact::DEFAULT_AVATAR_THUMB;
- $micro = DI::baseUrl() . Contact::DEFAULT_AVATAR_MICRO;
+ $contact = Contact::getById($cid) ?: [];
+ $image_url = Contact::getDefaultAvatar($contact, Proxy::SIZE_SMALL);
+ $thumb = Contact::getDefaultAvatar($contact, Proxy::SIZE_THUMB);
+ $micro = Contact::getDefaultAvatar($contact, Proxy::SIZE_MICRO);
}
return [$image_url, $thumb, $micro];