Clean Image Filenames

Description

Filenames with special characters or language accent characters, like Château de Ferrières.jpg and smörgåsbord.png, can sometimes be a problem for browsers or servers. This plugin takes care of that and cleans the filenames of files uploaded to the WordPress media library.

This plugin cleans the filenames from special characters like exclamation marks, periods, and commas and accent characters like Swedish and German umlauts. Special characters are remove, accent characters are converted to their non-accent equivalent, and blank spaces are converted into dashes.

Easily set the plugin to clean the filenames of images only or all files uploaded to the media library. Developers can take advantage of the built in filter to get really specific about what file types to clean the filenames of.

Features

  • Can be used for all file types, only image file types, or only specific file types
  • Is multisite compatible
  • Works with custom upload_dir setups
  • Doesn’t alter your database or uploads settings

Plugin filter for developers

Developers can get really specific about what file types to clean by using the clean_image_filenames_mime_types filter in their plugins or themes. When using this filter, settings saved through the settings page are overridden. For a complete list of mime types, see Wikipedia.

The following example would make the plugin clean the filenames for PDF, JPEG and PNG files only.

function my_clean_image_filenames_mime_types() {
    $mime_types = array(
        'application/pdf', 
        'image/jpeg', 
        'image/png', 
    );
    return $mime_types;
}
add_filter('clean_image_filenames_mime_types', 'my_clean_image_filenames_mime_types');

Screenshots

  • Easily choose between cleaning the filenames of all files or images only.

Installation

  1. Upload the clean-image-filenames directory to the /wp-content/plugins/ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.

FAQ

Installation Instructions
  1. Upload the clean-image-filenames directory to the /wp-content/plugins/ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
Why does this plugin exist?

No matter how hard you try to teach people to name their files in a certain way before uploading, sooner or later you will end up with a media library with filenames like Château de Ferrières.jpg or Smörgåsbord.png. Sometimes browsers have a hard time displaying images with filenames like these and the images end up broken.

Can this plugin clean the filenames of existing files in the media library?

No, this plugin only cleans the filenames of files when they are being uploaded to the media library.

Reviews

Excellent

As we live in times where computing related activities don’t take place anymore in English only, this “little” plugin is a life saver!

I just had it happen on a pilot community project where people could upload their own images.
Of course everything worked fine, they uploaded their images with special characters and they did show up where they should.

Then there came the time to move to a different server, usually an easy task for most WordPress migration plugins and BAMM – the images with special characters in the filenames didn’t make it.

The same happened when making a backup / restore!

And yes, I used the commercial pro version of 2 of the highest ranking migration- and backup tools which usually work like a charm, but I also didn’t had the situation with this kind of filenames before.

Fortunately this was just a pilot project without a hard death-line and there where just a few dozen images affected by this, which could be fixed manually. But imagine what if there where a few hundreds or thousands …

So I came to find this little awesome plugin, which helps me to prevent this happen again.

Many thanks to Gesen and Upperdog for bringing this to WordPress and 10’000+ active installations approves the necessity of it’s functionality to me.

And shame on WordPress, why this kind of basic functionality isn’t in the core. Even in the USA there are more languages used then just plain vanilla english.

Maybe it also should address the backup and migration plugin developers, which do an excellent job in general and did trip over this special character filename glitch.

Great

Super handy plugin that saved me a huge headache!!

Thank you!!

A must

This should be integrated in WP core. Always giving problems in site migrations…
Thanks for your work!

Read all 11 reviews

Contributors & Developers

“Clean Image Filenames” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.1.1

  • Added uninstall script that deletes plugin settings when the plugin is uninstalled.

1.1

  • Added plugin settings to media settings page with option to convert all file types or just image file types.
  • Added shortcut to plugin settings from the plugins list.

1.0

  • Initial release.