Results 1 to 7 of 7

Thread: Preventing download of my images

  1. #1
    Join Date
    Feb 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Preventing download of my images

    Greetings All,


    I wish to prevent my images from being downloaded by dragging. I know there are always ways someone can get around this and grab images off a site, but I want to at least put up a little road block. I have used a bit of code which said some thing like 'on mouse over no action' or something like that.

    Is there a way to apply this type of function globally to all images on a site, without adding code to each image??

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Insert this code in the <head> part of your document:
    Code:
    <script type="text/javascript">
    var drag = function(){
      var els = document.getElementsByTagName("img");
      for(var i = 0; i < els.length; i++){
        var over = document.createElement("div");
    	over.style.position = "absolute";
    	over.style.height = els[i].height;
    	over.style.width = els[i].width;
    	over.style.backgroundColor = "transparent";
    	over.style.left = els[i].offsetLeft;
    	over.style.top = els[i].offsetTop;
    	document.body.appendChild(over);
      }
    
    }
    </script>
    Insert this code right before </body>:
    Code:
    <script type="text/javascript">
    drag();
    </script>
    Jeremy | jfein.net

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    It cannot be said enough that trying to stop people from saving media on your site cannot be done. It can be made difficult especially with audio and video, but with images there are so many ways to save them that it's really not worth the effort. Anything that comes close to stopping people (even just for a few of the ways) will probably annoy your other "real" visitors, and people will enjoy your site less.

    When you publish something on the web it may be stolen. That's life, and that's how it works and how it will work. There really isn't much you can do about it.

    There are always ways you can try to make it harder for the average user, but it won't be the average user that is stealing from your site: it will be people who know what they are doing. And if an average user wants to steal your content enough, I'm confident they could learn how.

    The main reason that you can't stop people from doing this is that they can do a screen capture. So nothing at all can stop this. (The only method I know about is to place it in a form of media (for example a quicktime movie) that outputs it right into video memory rather than the actual "screen", but there are then many other ways around that, or just using a Mac or other computer that doesn't do multi-layered video memory).

    You can try, but it won't work. You can ignore me on this (and most people do for a while until they try it for themselves and figure out how it works), but while you try, please consider how it may negatively affect the rest of your users. Frequently it's better to just let people steal and not annoy the "good" users in the process.


    The real methods you have available to stop this are:
    1. Copyright: if something actually matters in the end, you can claim legal ownership. For example, if someone else uses your content on their webpage, you can contact their host and they will suspend an account if it is a breach of copyright. (at least this happens often... sometimes the legal issues get more complex if it actually goes to court, etc)
    2. Watermarks: make your image messed up so that if they steal them they aren't really stealing anything.
    3. Small resolution: don't post full size images on your website. Post small images so that if they steal them they don't have the "real thing".
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    The "big picture" is what people don't understand.

    Visitors don't "go to" your website. You send your website to your visitors.

    This means that people don't have to "figure out" a way to save your content - it's already saved on their computer. They may not know exactly where (e.g., somewhere in their temp internet folder), but that's basically the only roadblock. And that's the worst case scenario: they can almost always just use [print screen].

    more, if you're interested. I think I've done enough hijacking.

  5. #5
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    I believe all he wanted was to not let the user drag the image onto there desktop... My code does that.
    Jeremy | jfein.net

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Code can be written for various things like this. Generally though, it's not cross browser. I didn't test your code, so I cannot be certain in this case Nile.

    But it's somewhat immaterial. The real problem with these schemes is that they add to the page load and can cause unexpected issues in some situations. Users should be able to make copies for their own non-commercial use. If you are selling the images, never put the actual full quality image on the web.

    The images are often not worth protecting, it is more a matter of pride than economics. Where there is a real issue of economics, copyright law is your best protection. But you should take care first to use lower res versions of images, and/or thumbnails only, and/or watermark them if economics is a real issue.

    A fairly inexpensive way to protect your images should legal action ever become necessary is to in advance put them on a CD or other media (prints or negatives will do as well, and can be good for individual images) and mail them to yourself. Keep the envelope/package unopened unless or until you are in a binding forum like court or arbitration. There you can open the package after first establishing that the postmark's date shows the date of origin of the images and show those involved that you had them first.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Nile, that code will work for some visitors. I have never seen a code that will stop that functionality for safari on OSX, though. That's not a majority of users, but the question is whether it's worth having the code for most users if not for all users.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •