From: Friendika Date: Tue, 10 May 2011 05:44:14 +0000 (-0700) Subject: re-fetch FB photos that failed X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=92622918313b863222256a54adf247a1f8ea6831;p=friendica.git re-fetch FB photos that failed --- diff --git a/addon/facebook/facebook.php b/addon/facebook/facebook.php index 2120459c39..76b26003c1 100644 --- a/addon/facebook/facebook.php +++ b/addon/facebook/facebook.php @@ -141,6 +141,31 @@ function fb_get_friends($uid) { ); if(count($r)) { + + // check that we have all the photos, this has been known to fail on occasion + + if((! $r[0]['photo']) || (! $r[0]['thumb']) || (! $r[0]['micro'])) { + require_once("Photo.php"); + + $photos = import_profile_photo('https://graph.facebook.com/' . $jp->id . '/picture', $uid, $r[0]['id']); + + $r = q("UPDATE `contact` SET `photo` = '%s', + `thumb` = '%s', + `micro` = '%s', + `name-date` = '%s', + `uri-date` = '%s', + `avatar-date` = '%s' + WHERE `id` = %d LIMIT 1 + ", + dbesc($photos[0]), + dbesc($photos[1]), + dbesc($photos[2]), + dbesc(datetime_convert()), + dbesc(datetime_convert()), + dbesc(datetime_convert()), + intval($r[0]['id']) + ); + } continue; } else {