From ae6748a4650abf3f4066378e1f74a2bbd5d7a1bc Mon Sep 17 00:00:00 2001 From: Matthew Exon Date: Thu, 9 Jan 2020 21:41:52 +0100 Subject: [PATCH] Repair missing contact photos --- src/Model/Contact.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 0540bf7beb..7722b69909 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -1896,6 +1896,14 @@ class Contact $data = [$contact["photo"], $contact["thumb"], $contact["micro"]]; } + foreach ($data as $image_uri) { + $image_rid = Photo::ridFromURI($image_uri); + if ($image_rid && !Photo::exists(['resource-id' => $image_rid, 'uid' => $uid])) { + Logger::info('Regenerating avatar for contact uid ' . $uid . ' cid ' . $cid . ' missing photo ' . $image_rid . ' avatar ' . $contact['avatar']); + $force = true; + } + } + if (($contact["avatar"] != $avatar) || $force) { $photos = Photo::importProfilePhoto($avatar, $uid, $cid, true); -- 2.39.5