WordPress out of the box isn’t very smart with image files. I wanted to automatically rename uploaded images to create pretty SEO filenames on my blog, but had to resort to creating my own plugin.
I think of myself as an organised person, at least when it comes to computers. I like to see everything in a logical order and in its proper place. Sometimes it’s frustrating that with all the computing power that today’s machines have, I still have to put in a lot of effort renaming and ordering files on my computer. Or worse yet, on my blog… (I say “worse” because it’s public.)
A simple thing I’d like to achieve is adding my blog name to my image files. Many times people see something they’d like to keep a copy of on the Internet and download the image on their computer. Then they get a file that might be called
DSC0123.jpg in their downloads folder. I’d hate that happening with my content: I want people to get
EnriquesThoughts.WordPress.com-Really-Fancy-Picture.jpg so that whenever they look at it, they’re reminded that it was from my blog.
(And, if some bastard steals my Really Fancy Picture, they have to go through the trouble of renaming it themselves!)
And, there’s another, maybe even more important point here: Search engines such as Google might literally send you thousands of hits via their image search, but, of course, your images must come up in the results first.
So I learnt that search engines just love filenames that actually make sense: a filename that describes the content is a great thing for them, since they don’t have to try to guess from the context what the actual content of the image is.
Google makes it clear in their Image Publishing Guidelines:
Give your images detailed, informative filenames
The filename can give Google clues about the subject matter of the image. Try to make your filename a good description of the subject matter of the image. For example, my-new-black-kitten.jpg is a lot more informative than IMG00023.JPG. Descriptive filenames can also be useful to users: If we’re unable to find suitable text in the page on which we found the image, we’ll use the filename as the image’s snippet in our search results.
For more details, have a look at For Dummies: Name Your Web-Site Files for Better SEO Results and this question at ProWebmasters.
Of course, hand renaming of image files is the ultimate way to describe the “subject matter”, but I thought that probably the post title is a great resource to be used here. After all, for SEO purposes, those SEO content plugins out there try to make sure you have your keywords in the post title, and generally the title is, of course, what should describe the content of the post. So ideally, the image files should get their filename from the post title, with possible hand tuning using the alt tag.
So, there are three things I wanted:
- Add my blog name to my image files,
- Give the image file a human-readable, descriptive name using the post title, and
- Have this happen automatically.
When I first started fiddling with WordPress, I thought this kind of functionality would be easily found if not in the system itself, then as a plugin. But I couldn’t find any solutions! It was up to me to brush up the old PHP coding skills and do it myself. I called the result Easy Upload Renamer.
My plugin automatically intervenes when you upload a file to WordPress: it adds your custom text (like your blog name) to the filename and renames the file using the post title. It’s highly customizable and creates pretty filenames in almost any scenario.
Also, according to the current SEO community consensus about URLs, all filenames are made lowercase.
The Easy Batch Uploader plugin has been around for about a year and it’s stable and working. There used to be an issue with Non-Latin scripts (what do you do if the post title is, for instance, in Cyrillic or Arabic?), but these issues were addressed in the version 2.0.0 of the plugin with custom multibyte string handling.
(The fundamental question to ask here is: Is WordPress truly a Unicode application? Is PHP? But those are topics for another post.)