Our very own WordPress plugin!

Our very own WordPress plugin!

7. October 2015 - by Hendrik Luehrsen

Being WordPress developers our first intention in building free-images.cc was always to provide a great WordPress plugin. Here is how we built it.

In the beginning there was an idea

unsplash.com - One of the inspirations for our WordPress Plugins

unsplash.com – One of the inspirations for our WordPress Plugins

In our agency Luehrsen // Heinrich we craft content every day. For blogs, facebook, twitter and much more. But we always hit limits in finding great imagery for our stories. The common stock photo licenses are expensive, restrictive and not very useful in a daily workflow. Especially not when you want to use social media. (Most licenses disallow the use of their stock photography on social media.)

So we started using CC0 image databases ourselves. We LOVE Unsplash and use it almost every day! But the workflow wasn’t good. As tech savvy people it did not seem to be a great burden for us to download the image, reupload it again and insert into our posts. But while talking to our clients it became clear that the process was not very straightforward for everyone else. So we started thinking about a solution.

Provide every free image available!

Our first idea was to build a crawler inside a WordPress plugin, that crawls the best CC0 pages and displays the results similar to what the plugin looks right now. Wouldn’t that be great? To have the entirety of free images available in your
backend? Yeah, we thought so as well!

So we started building it! The crawler was quickly hacked together and the results were there. But we were not happy, because the results were bad. Really bad.

We had all the images we wanted to be there, but hidden in a pile of mediocre and plain bad imagery. And we haven’t even started worrying about duplicates, performance and server load. So because of all of these issues the crawler idea was quickly off the table, we needed something else.

The human factor

The realization, that the crawler didn’t work was a disaster for us. We wanted to have it all, but now we had nothing!

After going back to the drawing board we made a plan of what we expected a good plugin to do, minus the features that are not feasible. The concept was quickly outlined. We wanted a tightly integrated WordPress plugin, that gives straightforward access to great images and makes it easy to work with.

But where should we pull the images from? A database with tagged images and a REST API had to be created and maintained. That gave us the freedom to ensure, that only the best images would end up in the plugin.

Building a WordPress Plugin

Our Plugin in the WordPress repositoryThe team was split into three divisions. Chris started writing the plugin itself, Hendrik was responsible for building the backend and API and Volker made sure, that only the best images were inserted into the database.

While building the backend and API was pretty straightforward, the plugin was quite some task to overcome.

We quickly learned that the documented hooks and methods in the WordPress Codex were not enough to build the level of integration into the Media Manager we wanted to achieve. So we ventured into deeply uncharted territory of the WordPress Backbone JS code and extended the available functions to integrate our business logic. We managed to pull it off in under 800 lines of code of JavaScript. By doing that we ensured, that we did not build a function we did not desperately need. For every new function we  tried to find out if there wasn’t a WordPress function already available that could do the task.

The result as a beautifully written, tightly integrated, very performant plugin, that does exactly what it needs to do: Display and import beautiful images.

A website afterthought

Now we had a beautifully crafted WordPress plugin, a server infrastructure with a database filled with great images and the methods for them to communicate. Job well done, mission accomplished.

Well, not quite. How would we promote that? We have to have some sort of landing page to show what the plugin could do.

Almost as an afterthought we decided, that not only plugin users should benefit from our great selection of images. Volker quickly hacked together a design, Hendrik built the frontend and to our pleasure the backend was already there.

Whats next?

That is pretty much where we are now. We have a great collection of images and a great plugin. And the people seem to love it!

But there is still something in the concept, that we haven’t done yet! We are listening to the users and try to understand their needs.

So the journey is not yet over. Stay tuned for the things to come!