Catch exception when trying to determine the creation_date

This commit is contained in:
Deon George 2024-09-29 18:07:38 +10:00
parent 4e39d01876
commit 6184eb429a

View File

@ -158,10 +158,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;