{
$condition = ["`avatar` != ? AND `photo` LIKE ? AND `uid` = ? AND `uri-id` != ? AND NOT `uri-id` IS NULL",
'', $this->baseurl->get() . '/photo/%', 0, 0];
- $total = $this->dba->count('contact', $condition);
+
+ $count = 0;
+ $total = $this->dba->count('contact', $condition);
$contacts = $this->dba->select('contact', ['id', 'avatar', 'photo', 'uri-id', 'url', 'avatar'], $condition, ['order' => ['id' => true]]);
- $count = 0;
while ($contact = $this->dba->fetch($contacts)) {
echo ++$count . '/' . $total . "\t" . $contact['id'] . "\t" . $contact['url'] . "\t";
$resourceid = Photo::ridFromURI($contact['photo']);
echo $this->l10n->t('no photo') . "\n";
continue;
}
-
+
echo '2';
$imgdata = Photo::getImageDataForPhoto($photo);
if (empty($imgdata)) {
echo $this->l10n->t('invalid image') . "\n";
continue;
}
-
+
echo '4';
$fields = Avatar::storeAvatarByImage($contact, $image);
echo '5';
Photo::delete(['resource-id' => $resourceid]);
echo ' '.$fields['photo'] . "\n";
}
-
+
return 0;
}
}