Image fetch and resize working.

This commit is contained in:
Kim Taylor
2024-09-23 23:25:12 +10:00
parent f9c151bfae
commit c27cc2831b
3 changed files with 54 additions and 12 deletions

View File

@@ -61,7 +61,9 @@ foreach ($lga_list as $lga) {
if (count($lga_candidates) === 0) continue;
$output_file = dirname($lga['config-file'])."/candidates-generic.csv";
$dir = dirname($lga['config-file']);
$dir_files = scandir($dir);
$output_file = $dir."/candidates-generic.csv";
if (($handle = fopen($output_file, "w")) === FALSE) {
error_log('Error opening output file');
@@ -74,10 +76,18 @@ foreach ($lga_list as $lga) {
}
foreach ($lga_candidates as $candidate) {
/* Add extension to photo hash */
foreach ($dir_files as $file) {
if (strstr($file, $candidate['Photo'])) {
$candidate['Photo'] = $file;
}
}
$fields = [
$candidate['match_ward'],
$candidate['Name'],
$candidate['Score'],
$candidate['Pledge'],
$candidate['Photo'],
];