X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FUser.php;h=93538bce641d684ba3601767fdffcc1a67f7288d;hb=f6e4984d7ee6690742da8d3a925b038a7bf9da09;hp=ccc9261fd22e4168c99acaa01d17cd4bd92f4dae;hpb=77906627c5bb57d404d40702f89c205d1faa9542;p=friendica.git diff --git a/src/Model/User.php b/src/Model/User.php index ccc9261fd2..93538bce64 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -850,19 +850,16 @@ class User break; } - $updated = ''; - $imagetype = IMAGETYPE_JPEG; + $updated = ''; + $mimetype = ''; $photo = Photo::selectFirst(['type', 'created', 'edited', 'updated'], ["scale" => $scale, 'uid' => $user['uid'], 'profile' => true]); if (!empty($photo)) { - $updated = max($photo['created'], $photo['edited'], $photo['updated']); - - if (in_array($photo['type'], ['image/png', 'image/gif'])) { - $imagetype = IMAGETYPE_PNG; - } + $updated = max($photo['created'], $photo['edited'], $photo['updated']); + $mimetype = $photo['type']; } - return $url . $user['nickname'] . image_type_to_extension($imagetype) . ($updated ? '?ts=' . strtotime($updated) : ''); + return $url . $user['nickname'] . Images::getExtensionByMimeType($mimetype) . ($updated ? '?ts=' . strtotime($updated) : ''); } /** @@ -880,19 +877,19 @@ class User $url = DI::baseUrl() . '/photo/banner/'; - $updated = ''; - $imagetype = IMAGETYPE_JPEG; + $updated = ''; + $mimetype = ''; $photo = Photo::selectFirst(['type', 'created', 'edited', 'updated'], ["scale" => 3, 'uid' => $user['uid'], 'photo-type' => Photo::USER_BANNER]); if (!empty($photo)) { - $updated = max($photo['created'], $photo['edited'], $photo['updated']); - - if (in_array($photo['type'], ['image/png', 'image/gif'])) { - $imagetype = IMAGETYPE_PNG; - } + $updated = max($photo['created'], $photo['edited'], $photo['updated']); + $mimetype = $photo['type']; + } else { + // Only for the RC phase: Don't return an image link for the default picture + return ''; } - return $url . $user['nickname'] . image_type_to_extension($imagetype) . ($updated ? '?ts=' . strtotime($updated) : ''); + return $url . $user['nickname'] . Images::getExtensionByMimeType($mimetype) . ($updated ? '?ts=' . strtotime($updated) : ''); } /**