diff --git a/app/Models/Photo.php b/app/Models/Photo.php index f31ee38..acf13b2 100644 --- a/app/Models/Photo.php +++ b/app/Models/Photo.php @@ -8,7 +8,6 @@ use Illuminate\Support\Traits\ForwardsCalls; use Imagick; use App\Casts\PostgresBytea; -use App\Jobs\CatalogMove; class Photo extends Abstracted\Catalog { @@ -158,10 +157,17 @@ class Photo extends Abstracted\Catalog && $this->Imagick_getImageProperty('exif:DateTime') === '0000:00:00 00:00:00') return NULL; - $result = Carbon::create($x= - ($this->Imagick_getImageProperty('exif:DateTimeOriginal') && ($this->Imagick_getImageProperty('exif:DateTimeOriginal') !== '0000:00:00 00:00:00')) - ? $this->Imagick_getImageProperty('exif:DateTimeOriginal').$this->Imagick_getImageProperty('exif:OffsetTimeOriginal') - : $this->Imagick_getImageProperty('exif:DateTime').$this->Imagick_getImageProperty('exif:OffsetTime')); + try { + $result = Carbon::create( + ($this->Imagick_getImageProperty('exif:DateTimeOriginal') && ($this->Imagick_getImageProperty('exif:DateTimeOriginal') !== '0000:00:00 00:00:00')) + ? $this->Imagick_getImageProperty('exif:DateTimeOriginal').$this->Imagick_getImageProperty('exif:OffsetTimeOriginal') + : $this->Imagick_getImageProperty('exif:DateTime').$this->Imagick_getImageProperty('exif:OffsetTime')); + + } catch (\Exception $e) { + Log::alert(sprintf('We got exception [%s] when finding the create date',$e->getMessage())); + + return NULL; + } return $result ?: NULL;