Image fetch and resize working.
This commit is contained in:
@@ -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'],
|
||||
];
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ function parse_generic_csv($generic_csv) {
|
||||
if (strstr($value, "Political Party")) $value = "Party";
|
||||
|
||||
if ($value === "Pledge") {
|
||||
if (strstr($data[$key], "I pledge")) $data[$key] = "Yes";
|
||||
else $data[$key] = "No";
|
||||
if (strstr($data[$key], "I pledge")) $data[$key] = "y";
|
||||
else $data[$key] = "n";
|
||||
}
|
||||
|
||||
if ($value === "Photo") {
|
||||
|
||||
Reference in New Issue
Block a user