Skip to content

Commit 915a4fd

Browse files
committed
fix: Add tags last to avoid errors saving photo
1 parent 9023f11 commit 915a4fd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Controller/Admin.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,6 @@ public function updatePhoto(
417417
$photo->ulid = \Ulid\Ulid::generate(true);
418418
$photo->filename = $fn;
419419

420-
$photo->tags($request->getParam('tags'));
421-
422420
$photo->name = $request->getParam('name');
423421
$photo->alt_text = $request->getParam('alt_text');
424422
$photo->caption = $request->getParam('caption');
@@ -427,13 +425,15 @@ public function updatePhoto(
427425
$photo->details = json_encode($details);
428426
$photo->thumbhash = $thumbhash;
429427

430-
$photo->width = $details->width ?? 0;
431-
$photo->height = $details->height ?? 0;
428+
$photo->width = $details->width;
429+
$photo->height = $details->height;
432430

433431
if (@$details->exif?->Image?->DateTime) {
434432
$photo->taken_at = (new \DateTime($details->exif->Image->DateTime))->format('Y-m-d H:i:s');
435433
}
436434

435+
$photo->tags($request->getParam('tags'));
436+
437437
$photo->save();
438438

439439
$this->data->commit();

0 commit comments

Comments
 (0)