WordPress Chinese image upload automatic rename
Because of the few people in the country to upload pictures before the name of the image renamed to English, so automatic renaming is particularly important for WP, especially Linux does not support Chinese names.
WordPress Upload the multimedia code are stored in \wp-admin\includes\ inside the file.php, open this file,FILENAME=WPUNIQUEFilename( uploads[' path '],FILE[′NA ′], Unique_filename_callback);//Move the file to the Uploads dir, before this sentence $filename assigned valueAdd the following code:
$time =date ("Ymdhis"); $type _change = Array (' image ' = = '); $file _type = STRTR ($file [' type '], $type _change);
$file [' name '] = $time. "". Mt_rand (1,100). "". $file _type;
The following code follows:
$time =Date ("Ymdhis"); $type _change = array (' image ' = '. '); $file _type = strtr ($ file[' type '], $type _change);
$file [' name '] = $time. " mt_rand (1,100). $file _type $filename = Wp_unique_filename ( $file [' name '], $unique _filename_callback// Move the file to the uploads dir span>
Save, after uploading the multimedia file is automatically renamed to 2014012315450088 format, year month date time and random number.
WordPress Chinese image upload automatic rename