2014-03-06, 01:28:16
clean_img_name removes @ and then urlencodes the string.
MODIFIED
(Also these is double encoding during the rename -n if existing. so instead of @->%40 we get %2540)
I do not know if removing the urlencode is wise, but it works. It might be wiser to convert the '%2540' back to @ after wards instead with str_replace
MODIFIED
PHP Code:
function clean_img_name($text) {
$text = strip_tags(lowercase($text));
$code_entities_match = array(' ?',' ','--','"','!','@','#','$','%','^','&','*','(',')','+','{','}','|',':','"','<','>','?','[',']','\\',';',"'",',','/','*','+','~','`','=');
$code_entities_replace = array('','-','-','','','@','','','','','','','','','','','','','','','','','','','',''); //EDITED @
$text = str_replace($code_entities_match, $code_entities_replace, $text);
// $text = urlencode($text); // REMOVED
$text = str_replace('--','-',$text);
$text = rtrim($text, "-");
return $text;
}
(Also these is double encoding during the rename -n if existing. so instead of @->%40 we get %2540)
I do not know if removing the urlencode is wise, but it works. It might be wiser to convert the '%2540' back to @ after wards instead with str_replace