Fix more bugs

This commit is contained in:
Alexander Rosenberg 2024-09-15 02:39:19 -07:00
parent a2b5773be0
commit 68393d2cf2
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

View File

@ -38,9 +38,7 @@ class Album {
$this->thumbnail = $root->{'thumbnail'};
$this->images = $root->{'images'};
if (property_exists($root, 'metadata')) {
$this->metadata = $root->{'metadata'};
} else {
$this->metadata = null;
$this->metadata;
}
}
@ -129,12 +127,27 @@ class Album {
'longitude' => ''
];
}
$description = $this->metadata->{$image}->{'description'};
$date = $this->metadata->{$image}->{'date'};
$time = $this->metadata->{$image}->{'time'};
$lat= $this->metadata->{$image}->{'latitude'};
$lon = $this->metadata->{$image}->{'longitude'};
if (preg_match($this::NUMBER_REGEX, $lat) === false || preg_match($this::NUMBER_REGEX, $lon) === false) {
$description = null;
$date = null;
$time = null;
$lat = null;
$lon = null;
if (property_exists($this->metadata->{$image}, 'description')) {
$description = $this->metadata->{$image}?->{'description'};
}
if (property_exists($this->metadata->{$image}, 'date')) {
$date = $this->metadata->{$image}?->{'date'};
}
if (property_exists($this->metadata->{$image}, 'time')) {
$time = $this->metadata->{$image}?->{'time'};
}
if (property_exists($this->metadata->{$image}, 'latitude')) {
$lat= $this->metadata->{$image}?->{'latitude'};
}
if (property_exists($this->metadata->{$image}, 'longitude')) {
$lon = $this->metadata->{$image}?->{'longitude'};
}
if ($lat && $lon && (preg_match($this::NUMBER_REGEX, $lat) === false || preg_match($this::NUMBER_REGEX, $lon) === false)) {
$lat = null;
$lon = null;
}