X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FPhoto.php;h=0f03b54b0dbac9677dfaca7ee2cb48a6211f5e76;hb=c3d0ab56a560809f0d331f3f45f1f213a2094358;hp=5f8551fa2708a70c7c8338df36b81bb578988708;hpb=8c328a3c60d3bcbc8b091158383bf829064d2c9c;p=friendica.git diff --git a/src/Model/Photo.php b/src/Model/Photo.php index 5f8551fa27..0f03b54b0d 100644 --- a/src/Model/Photo.php +++ b/src/Model/Photo.php @@ -32,6 +32,7 @@ use Friendica\Object\Image; 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"; @@ -422,19 +423,18 @@ class Photo $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()) { @@ -495,9 +495,10 @@ class Photo } 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];