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,10 +38,8 @@ class Album {
$this->thumbnail = $root->{'thumbnail'}; $this->thumbnail = $root->{'thumbnail'};
$this->images = $root->{'images'}; $this->images = $root->{'images'};
if (property_exists($root, 'metadata')) { if (property_exists($root, 'metadata')) {
$this->metadata = $root->{'metadata'}; $this->metadata;
} else { }
$this->metadata = null;
}
} }
private function invalidate() { private function invalidate() {
@ -129,12 +127,27 @@ class Album {
'longitude' => '' 'longitude' => ''
]; ];
} }
$description = $this->metadata->{$image}->{'description'}; $description = null;
$date = $this->metadata->{$image}->{'date'}; $date = null;
$time = $this->metadata->{$image}->{'time'}; $time = null;
$lat= $this->metadata->{$image}->{'latitude'}; $lat = null;
$lon = $this->metadata->{$image}->{'longitude'}; $lon = null;
if (preg_match($this::NUMBER_REGEX, $lat) === false || preg_match($this::NUMBER_REGEX, $lon) === false) { 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; $lat = null;
$lon = null; $lon = null;
} }