Some more code beauty

This commit is contained in:
Michael 2022-05-23 12:44:21 +00:00
parent 299c4df8f4
commit 68599c7efa

View File

@ -92,8 +92,8 @@ HELP;
echo ++$count . '/' . $total . "\t" . $contact['id'] . "\t" . $contact['url'] . "\t"; echo ++$count . '/' . $total . "\t" . $contact['id'] . "\t" . $contact['url'] . "\t";
$resourceid = Photo::ridFromURI($contact['photo']); $resourceid = Photo::ridFromURI($contact['photo']);
if (empty($resourceid)) { if (empty($resourceid)) {
echo $this->l10n->t('no resource') . "\n"; echo $this->l10n->t('no resource') . "\n";
continue; continue;
} }
echo '1'; echo '1';
$photo = Photo::selectFirst([], ['resource-id' => $resourceid], ['order' => ['scale']]); $photo = Photo::selectFirst([], ['resource-id' => $resourceid], ['order' => ['scale']]);
@ -105,14 +105,14 @@ HELP;
echo '2'; echo '2';
$imgdata = Photo::getImageDataForPhoto($photo); $imgdata = Photo::getImageDataForPhoto($photo);
if (empty($imgdata)) { if (empty($imgdata)) {
echo $this->l10n->t('no image data') . "\n"; echo $this->l10n->t('no image data') . "\n";
continue; continue;
} }
echo '3'; echo '3';
$image = new Image($imgdata, Images::getMimeTypeByData($imgdata)); $image = new Image($imgdata, Images::getMimeTypeByData($imgdata));
if (!$image->isValid()) { if (!$image->isValid()) {
echo $this->l10n->t('invalid image') . "\n"; echo $this->l10n->t('invalid image') . "\n";
continue; continue;
} }
echo '4'; echo '4';
@ -121,7 +121,7 @@ HELP;
Contact::update($fields, ['uri-id' => $contact['uri-id']]); Contact::update($fields, ['uri-id' => $contact['uri-id']]);
echo '6'; echo '6';
Photo::delete(['resource-id' => $resourceid]); Photo::delete(['resource-id' => $resourceid]);
echo ' '.$fields['photo'] . "\n"; echo ' ' . $fields['photo'] . "\n";
} }
return 0; return 0;