Don't try to match photos if the field is empty.

This commit is contained in:
Kim Taylor
2024-09-24 15:10:31 +10:00
parent db2d4fcbc7
commit 8b2e66b044

View File

@@ -77,10 +77,12 @@ foreach ($lga_list as $lga) {
foreach ($lga_candidates as $candidate) { foreach ($lga_candidates as $candidate) {
/* Add extension to photo hash */ /* Add extension to photo hash */
foreach ($dir_files as $file) { if (strlen($candidate['Photo'])) {
if (preg_match("/\.json$/", $file)) continue; foreach ($dir_files as $file) {
if (strstr($file, $candidate['Photo'])) { if (preg_match("/\.json$/", $file)) continue;
$candidate['Photo'] = $file; if (strstr($file, $candidate['Photo'])) {
$candidate['Photo'] = $file;
}
} }
} }