2017-09-10, 23:23:19
To avoid editing GS core files, make the following changes to Imagizer.php:
Distributed file, lines 56-65, inclusive:
Replace the above with the following lines:
This renames the uploaded file with lowercase extension before processing with Imagizer.
Submitted as a patch to Zorato's github page.
Distributed file, lines 56-65, inclusive:
PHP Code:
if(is_array($file['name'])){
foreach($file['name'] as $key => $name){
if (in_array($file['type'][$key],$image_types) || in_array(strtolower(pathinfo($name,PATHINFO_EXTENSION)),$image_ext) ){
process_file($target_dir . clean_img_name(to7bit($name)), $config);
}
}
}
elseif (in_array($file['type'],$image_types) || in_array(strtolower(pathinfo($file['name'],PATHINFO_EXTENSION)),$image_ext) ){
process_file($target_dir . clean_img_name(to7bit($file['name'])), $config);
}
Replace the above with the following lines:
PHP Code:
if(is_array($file['name'])){
foreach($file['name'] as $key => $name){
if (in_array($file['type'][$key],$image_types) || in_array(strtolower(pathinfo($name,PATHINFO_EXTENSION)),$image_ext) ){
$file_to_process = $target_dir . strtolower(clean_img_name(to7bit($file['name'])));
rename($target_dir . clean_img_name(pathinfo($file['name'],PATHINFO_FILENAME)).'.'.pathinfo($file['name'],PATHINFO_EXTENSION),$file_to_process);
process_file($file_to_process, $config);
}
}
}
elseif (in_array($file['type'],$image_types) || in_array(strtolower(pathinfo($file['name'],PATHINFO_EXTENSION)),$image_ext) ){
$file_to_process = $target_dir . strtolower(clean_img_name(to7bit($file['name'])));
rename($target_dir . clean_img_name(pathinfo($file['name'],PATHINFO_FILENAME)).'.'.pathinfo($file['name'],PATHINFO_EXTENSION),$file_to_process);
process_file($file_to_process, $config);
}
This renames the uploaded file with lowercase extension before processing with Imagizer.
Submitted as a patch to Zorato's github page.
--
Nick.
Nick.