How to stop your images from being pinned to Pinterest

February 20, 2012 | 9 comments

Pinterest screenshot

Pinterest is an interesting tool, and a lot of people I know love it.

This is how it works. You maintain a set of pinboards for different kinds of images – for example, I’ve got pinboards for logos, app wireframes, and interesting visuals. If you visit a site that has an image you’d like to keep, or share, you click a “pin it” button in your browser, and that image is copied to one of your pinboards.

Obviously, not everyone loves this. It arguably pushes the envelope of fair use, and will probably torch it completely once the owners attempt to monetize. Although images are linked to their origin pages, the attribution isn’t visually striking, and it’s not like the web is actually shared under an attribution license. I’m not a lawyer, but some people might see it as copyright theft.

To answer this, Pinterest have created a meta tag that you can stick at the top of your site: meta name=”pinterest” content=”nopin”. If it’s present on the parent page, Pinterest will refuse to copy your images (although I presume you can get around that by loading an individual image in the browser). Hackers are, rightly, protesting that this sets an unmanageable precedent: imagine having to individually opt out of having your content copied by thousands of different applications by having to stick thousands of different meta tags at the top of every page. It’s dramatically unscalable.

Pinning is not a million miles away from Tumblr‘s reblogging, and it seems reasonable that there should be a meta name=”republish” content=”no” meta tag that covers all of these services.

Until then, here’s some dubious fun you could have at your own risk (if you don’t want to include the meta tag). This was pretty common about ten years ago, when hotlinking images could cause major bandwidth bills for the owner.

  • Currently, the HTTP user agent for the bot that actually copies images for Pinterest is Pinterest/0.1 +http://pinterest.com/.
  • The JavaScript bookmarklet works through your browser, of course, but it sets the HTTP referer for the page to a URL starting with http://pinterest.com/pin/create/bookmarklet/.

I’d detect Pinterest based on user agent, not referer – there are many situations where referer could be stripped out. This is true for user agent too – this isn’t guaranteed to work 100% of the time, and depends on your server setup – but there are only two parties to worry about in this scenario: your server, and Pinterest’s. (If you’re filtering the bookmarklet, you also have to worry about configuration changes in the user’s browser.)

All you need to do is filter requests by user agent in your web server’s graphics folder. If you’re running Apache with mod_rewrite, you could create an .htaccess file in your graphics folder with rules like:

RewriteCond %{HTTP_USER_AGENT} ^Pinterest.*
RewriteRule .*\.png$ copyright.png

The above rewrites any requests for PNG files to copyright.png. The contents of that graphic will be pinned to Pinterest instead of the intended image.

(PS: want to try it out? Try pinning the image illustrating this blog post.)

Related entries

9 Comments

  1. Why do I have a feeling that this will lead to a resurgence in the appearance of Goatse…

    Marcus Povey February 21, 2012 (2:25 am)
  2. I see what you did there, googled “unscalable” to make sure it was a real word… At least now I know im not the only one…

    Brandon February 22, 2012 (5:33 pm)
  3. Thanks Ben!
    And your replacement graphic made me laugh out loud…;)

    Nicole February 24, 2012 (1:06 am)
  4. Ben,
    Try as I might, I could not get this mod rewrite to work with Pinterest. It appears to be doing the 302 substitution, but Pinterest just hangs at the Create Pin dialog and never completes.
    Any ideas?

    Brooks February 24, 2012 (8:08 pm)
  5. Brooks – another way to test is to write a PHP script that outputs your images. This might contain something like:

        header('Content-type: image/png');
    
        if (substr_count($_SERVER['HTTP_USER_AGENT'],'Pinterest'))
            echo file_get_contents('pinterest.png');
        else
            echo file_get_contents('substitute.png');
    

    You’d probably want to establish cacheing, etc.

    Ben Werdmuller February 25, 2012 (4:28 pm)
  6. Ben,

    Thanks again! Yes, I thought about this approach, but the .htacess would be so much nicer for rolling out to several existing sites, rather than trying to insert any PHP image management solution – I suppose a combination would also work (rediirect all image requests to PHP image delivery), but I would still rather use the straight forward redir.
    Just thought you might have run across this error (hang on delivery) and have a tip.
    There’s nothing weird like the image dimensions have to match between the requested and delivered image or something like that?
    Thanks again. This is still a great solution… even if I can’t get it to work :-)

    Brooks February 26, 2012 (3:09 pm)
  7. Thank you! Not that I have anything worth pinning but it’s nice to know there’s a blog I regularly read that covers this! Sal x

    salidatious February 27, 2012 (3:20 am)
  8. My site is image based and I have all of the good stuff, barring tiny thumbs and cropped banners locked in Flash albums. Works for me!

    PJ March 30, 2012 (10:05 pm)
  9. why make an invalid attribute? couldn’t you have used data-nopin=”nopin” so we can still have valid HTML? This seems like a no brainer to me

    Jared Henderson January 7, 2013 (8:58 am)

Leave a comment