- Forums
- Snippets
- Clean Image File Name Function Written In Php To Remove Special Characters
This Page Contains information about Clean Image File Name Function Written In Php To Remove Special Characters By wallpaperama in category Snippets with 1 Replies. [1381], Last Updated: Tue Feb 07, 2023
wallpaperama
Mon Feb 25, 2008
1 Comments
2084 Visits
function clean_image_name($name)
{
$name = strtolower($name);
$code_entities_match = array( '"' ,'!' ,'@' ,'#' ,'$' ,'%' ,'^' ,'&' ,'*' ,'(' ,')' ,'+' ,'{' ,'}' ,'|' ,':' ,'"' ,'<' ,'>' ,'?' ,'[' ,']' ,'' ,';' ,"'" ,',' ,'_' ,'/' ,'*' ,'+' ,'~' ,'`' ,'=' ,' ' ,'---' ,'--','--');
$code_entities_replace = array('' ,'-' ,'-' ,'' ,'' ,'' ,'-' ,'-' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ,'-' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ,'-' ,'-' ,'-' ,'' ,'' ,'' ,'' ,'' ,'-' ,'-' ,'-','-');
$name = str_replace($code_entities_match, $code_entities_replace, $name);
return $name;
}
https://www.wallpaperama.com/forums/clean-image-file-name-function-in-php-t5804.html