For the past few weeks, I’ve been working on a web application that’s being built on top of WordPress.

One of the requirements dictated the users should be able to have rich editing from the front end after being logged in. This includes being able to do the usual bold, italic, strikes, and link, as well as images and videos.

Redactor.js is a fantastic jQuery plugin that brings front-end editing to any website or web application, but implementing Redactor JS image upload and WordPress proved to be a bit of a challenge specifically because I wanted to keep all images organized in the standard wp-content/uploads directory.

So, while working on said project, I also generalized the script a bit and created Redactor Image Upload For WordPress.

It’s a short, simple title, right? Right-ish.

Redactor Image Upload For WordPress

Redactor Image Upload For WordPress

Generally speaking, the script is a single file that you drop into your WordPress theme and then reference in the Redactor.js initialization code. From there, the script will do the following things:

  • Attempt to upload the script into the uploads/YEAR/MONTH directory
  • If the year and/or month directories don’t exist, it will create them based on the current date
  • Check to see if a file with the same name exists
  • If so, increment a suffix on the filename and then copy it over
  • Officially return the Image URL to the browser

Note that this project is not a WordPress plugin, but is is a script that’s intended to be used with Redactor and with WordPress. There’s more documentation on the GitHub project page.

Looking For Contributors

Redactor.js is a plugin that I highly recommend – I know a number of developers who are constantly looking for ways to implement front end editing and this has been my favorite solution.

That said, this script isn’t perfect (hence version 0.1) so if you’re currently using Redactor and notice any bugs or issues or have a feature request for this script, please do a pull request or open an issue.

I’m far more concerned with having a solid library available for the WordPress community at large than I am having a single script that works for a few one-off projects of my own.