Issue 12327: Convert avatars to static

This commit is contained in:
Michael 2022-12-04 23:31:23 +00:00
parent 62f982cf7e
commit 5bff6f38d7
5 changed files with 32 additions and 9 deletions

View file

@ -109,9 +109,9 @@ class Account extends BaseDataTransferObject
$this->note = BBCode::convertForUriId($account['uri-id'], $account['about'], BBCode::EXTERNAL);
$this->url = $account['url'];
$this->avatar = Contact::getAvatarUrlForId($account['id'] ?? 0 ?: $account['pid'], Proxy::SIZE_SMALL, $account['updated'], $account['guid'] ?? '');
$this->avatar_static = $this->avatar;
$this->avatar_static = Contact::getAvatarUrlForId($account['id'] ?? 0 ?: $account['pid'], Proxy::SIZE_SMALL, $account['updated'], $account['guid'] ?? '', true);
$this->header = Contact::getHeaderUrlForId($account['id'] ?? 0 ?: $account['pid'], '', $account['updated'], $account['guid'] ?? '');
$this->header_static = $this->header;
$this->header_static = Contact::getHeaderUrlForId($account['id'] ?? 0 ?: $account['pid'], '', $account['updated'], $account['guid'] ?? '', true);
$this->followers_count = $account['ap-followers_count'] ?? $account['diaspora-interacted_count'] ?? 0;
$this->following_count = $account['ap-following_count'] ?? $account['diaspora-interacting_count'] ?? 0;
$this->statuses_count = $account['ap-statuses_count'] ?? $account['diaspora-post_count'] ?? 0;

View file

@ -57,7 +57,7 @@ class Image
*/
public function __construct(string $data, string $type = null)
{
$this->imagick = class_exists('Imagick');
$this->imagick = class_exists('Imagick') && !class_exists('GDImage');
$this->types = Images::supportedTypes();
if (!array_key_exists($type, $this->types)) {
$type = 'image/jpeg';
@ -751,7 +751,7 @@ class Image
$row = [];
for ($x = 0; $x < $width; ++$x) {
$index = imagecolorat($this->image, $x, $y);
$colors = imagecolorsforindex($this->image, $index);
$colors = @imagecolorsforindex($this->image, $index);
$row[] = [$colors['red'], $colors['green'], $colors['blue']];
}