Jump to page:
Page 1: Introduction
Page 2: Non-technical solutions
Page 3: Technical solutions
Page 4: Summary
Quick links:
things home page
about you
circle line walk
tribute to field (opens in new window)
adventures in povray - part 1
adventures in povray - part 2
supanames rant
bandwidth leeching
So someone's hotlinking to your image "InnocentPuppies.jpg", and stealing your bandwidth in the process. One option is to simply change the name of the image (e.g. "InnocentPuppies1.jpg"), and update the references in your own website to point to the new image. The dirty bandwidth leeches are left with a broken link to a nonexistent image, saving your bandwidth.
If you're not too worried about the bandwidth, but are annoyed about the theft of your images, you could be cheekier and instead of renaming as described above, keep a file called "InnocentPuppies.jpg" on your website, but change it to be another image:
This will of course still cost you the bandwidth of serving up the replacement image, but at least you get your own back somewhat, and hopefully teach the leech a lesson in the process!
It's a hassle having to make sure you don't miss any references to images from your own site - you don't want to accidentally have broken links, or even worse your "anti bandwidth leeching replacement image" displayed on your own pages! Also, if the leech is particularly persistent they can simply rename their own link accordingly each time you rename yours.
Having said that, it's a very quick and easy low-tech solution, and if you're only having trouble with one or two images, it might be just what you need.
Whereas many of the solutions described in this article will be effective for all sorts of site content, the next couple of solutions relate specifically to images.
Instead of trying to prevent hotlinking of images on your site, make the images themselves impossible (or at least difficult) to hotlink. One way of doing this is to split your images into a number of pieces, and re-compose the image on your website using a table or CSS layout. For example, split your image into 4 smaller images, and create a two-row, two-column table, with a piece in each table cell:
Original image:
Sliced image, re-composed in a table:
(obviously when you do this properly you don't have borders or cell-spacing, so that the four individual pieces join up seamlessly)
This technique doesn't stop bandwidth leeching - it's just designed to make it pointless.
Unfortunately many simpletons out there will still attempt to hotlink your image, but end up hotlinking just to one piece of your image instead. A good side effect of this is that they're only leeching a quarter of the bandwidth, and when they see that they haven't got the entire image they'll hopefully delete the link and give up.
Of course you can't stop the leeches from using the same table/CSS layout to re-assemble the pieces of the image on their own site - in fact, if they simply cut and paste the relevant section out of the source of your page you've actually done some of the work for them... Still, the average leech won't go to that much trouble.
It does take quite a lot of effort on your part. You have to split the image up, then write the html to re-compose it again on your site. Then if you want to edit the image you have to make sure you've kept an original copy around, make the edit, then split it up again, copy up the individual pieces, etc. Admittedly there are programs out there that will do this for you, and generate the html code automatically.
I don't know how original this technique is, but it's certainly something I came up with independently, so I'll claim it as my own! Apologies to all the people out there who no doubt thought of this ages ago (though I've been using it in one form or another for at least 4 years now).
It's a multi-pronged attack - I create my image, then increase the canvas size by a thousand pixels or so in each direction, and add some anti-leeching message in the extended portion of the canvas (here's an example). Next I create a one-cell table, use the image as the table background, and in the table cell stretch a 1x1 pixel transparent GIF to the dimensions of the image that I want my visitors to see, i.e. the area of the image NOT including the anti-leeching message.
Now when someone tries to right-click on the image to get its URL they actually get the URL of the 1x1 pixel transparent GIF, which costs me little bandwidth. Alternatively, if they're smart enough to link to the table background image, they'll end up with the huge image, including the giant anti-leeching message.
This tickles me greatly.
It's quite an effective way of preventing accidental and trivial leeching, and also a pretty good way of annoying more sneaky perpetrators.
Having said that, it does give you a bit more work when it comes to producing the image itself, and undoubtedly involves more effort on the html side - I get around this by wrapping the whole thing in a neat ASP.NET user control, which makes it's re-use trivial, but I suppose that would make this a technical rather than a non-technical solution.
It's also fair to mention that if someone does hotlink successfully to the image, they end up leeching a lot more bandwidth than if they'd simply linked to a normal copy of the image (instead of this huge one that's been created with the anti-leeching message).
Here's a radical idea - contact the owner of the website who is stealing your bandwidth, and ask them to stop! As I mentioned in the introduction, a lot of the time people don't even realise they're doing something wrong when they hotlink images from another site, and when you politely point out the error of their ways they may well stop doing it.
It's not always easy finding out who owns a website, or who's responsible for the content on the particular page, but there's no denying this can be a simple and effective low-tech solution! And it doesn't involve modifying one byte of your website. Of course anyone who's knowingly leeching your bandwidth is going to ignore your request, in which case you'll have to resort to one of the other techniques described here.
It's worth noting that many anti-leeching methods cause at least annoyance to the perpetrator, possibly embarrassment, or even worse (if you use a particularly "saucy" image for "technique 1: Manual file renaming" for example). So trying to contact the offender first might be an easy way to avoid entering into an all out war with them, if they fail to see the funny side of your counter-measures.
There are lots of 3rd party plugins and software packages out there that promise to prevent bandwidth leeching. I haven't looked into any of them, as I enjoy getting my hands dirty trying to code up my own solutions. If you are a cash-rich, time-poor web administrator however, desperately trying to solve a severe leeching problem, they might be the ticket.
Previous page: Introduction... Next page: Technical solutions...