Wordpress image hotlink plugin

Sometimes, when you are building a blog that is all about pictures, you want to give people any easy way to include those images in your own site and you don’t mind if they hotlink them (i.e. leech off your hosting) as long as you get a link back for your efforts.

I was building a site that needed exactly this functionality this weekend and, after a bit of searching around, I found Patrick Altoft’s Google Images hotlink wordpress plugin which did nearly what I wanted it to. Whenever a visitor comes from Google Images (or other search engines’ image searches) it pops up an instruction dialog box with code for embedding the image and linking back to the original post. Note that it only does this on individual post pages - not on images displayed on the homepage, category pages etc.

I wanted to do exactly that, but for all visitors - not just those from image searches.

Luckily, due to the open nature of the platform and the fact that Patrick released his plugin under the GPL, I was able to modify it to do my bidding. Since it’s all about the community, I am releasing my efforts here in case anyone wants to do the same thing as me:

So I’m happy to present my first wordpress plugin (even though it’s a modified version of Patrick’s - who I spoke to before releasing): hotlink builder. The linked zip file contains a file named hotlink-builder-distilled.php that should be placed in your ‘plugins’ folder (in wp-content) if you are running a wordpress blog. You will then be able to activate it from the plugins tab within the wordpress admin area and modify the default bit of text from the configuration link.

The zip file also contains a readme.txt file as per the wordpress guidelines that contains instructions etc. I hope you find it useful!

Here is an example of the information dialogue it places on the page when someone right-clicks on an image:


About the author
Will Critchlow

Will Critchlow

Will founded Distilled with Duncan in 2005. Since then, he has consulted with some of the world’s largest organisations and most famous websites, spoken at most major industry events and regularly appeared in local and national press. For the...   read more