1
1
Fork 0

Fix: Use correct condition to update the avatar

This commit is contained in:
Michael 2021-10-21 21:02:03 +00:00 committed by Hypolite Petovan
parent 09a809aee5
commit 17aa00bff8

View file

@ -92,6 +92,8 @@ class Crop extends BaseSettings
$Image->scaleDown(300); $Image->scaleDown(300);
} }
$condition = ['resource-id' => $resource_id, 'uid' => local_user(), 'contact-id' => 0];
$r = Photo::store( $r = Photo::store(
$Image, $Image,
local_user(), local_user(),
@ -105,7 +107,7 @@ class Crop extends BaseSettings
if ($r === false) { if ($r === false) {
notice(DI::l10n()->t('Image size reduction [%s] failed.', '300')); notice(DI::l10n()->t('Image size reduction [%s] failed.', '300'));
} else { } else {
Photo::update(['profile' => true], ['id' => $r['id']]); Photo::update(['profile' => true], array_merge($condition, ['scale' => 4]));
} }
$Image->scaleDown(80); $Image->scaleDown(80);
@ -123,7 +125,7 @@ class Crop extends BaseSettings
if ($r === false) { if ($r === false) {
notice(DI::l10n()->t('Image size reduction [%s] failed.', '80')); notice(DI::l10n()->t('Image size reduction [%s] failed.', '80'));
} else { } else {
Photo::update(['profile' => true], ['id' => $r['id']]); Photo::update(['profile' => true], array_merge($condition, ['scale' => 5]));
} }
$Image->scaleDown(48); $Image->scaleDown(48);
@ -141,7 +143,7 @@ class Crop extends BaseSettings
if ($r === false) { if ($r === false) {
notice(DI::l10n()->t('Image size reduction [%s] failed.', '48')); notice(DI::l10n()->t('Image size reduction [%s] failed.', '48'));
} else { } else {
Photo::update(['profile' => true], ['id' => $r['id']]); Photo::update(['profile' => true], array_merge($condition, ['scale' => 6]));
} }
Contact::updateSelfFromUserID(local_user(), true); Contact::updateSelfFromUserID(local_user(), true);