diff --git a/csv-generic/gen-generic.php b/csv-generic/gen-generic.php index 58295d1..2a961b9 100644 --- a/csv-generic/gen-generic.php +++ b/csv-generic/gen-generic.php @@ -77,10 +77,12 @@ foreach ($lga_list as $lga) { foreach ($lga_candidates as $candidate) { /* Add extension to photo hash */ - foreach ($dir_files as $file) { - if (preg_match("/\.json$/", $file)) continue; - if (strstr($file, $candidate['Photo'])) { - $candidate['Photo'] = $file; + if (strlen($candidate['Photo'])) { + foreach ($dir_files as $file) { + if (preg_match("/\.json$/", $file)) continue; + if (strstr($file, $candidate['Photo'])) { + $candidate['Photo'] = $file; + } } }