From: Matthew Exon Date: Thu, 9 Jan 2020 20:41:52 +0000 (+0100) Subject: Repair missing contact photos X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ae6748a4650abf3f4066378e1f74a2bbd5d7a1bc;p=friendica.git Repair missing contact photos --- 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);