Search code examples
phpimagepngblockmasking

Mask on images to prevent copying


There is on internet. Such script that, "jumps" before an another image. So... for example, if I found an image, and I click on "Save as..." I get a 1x1 pixel image in place of the one I wanted to safe.

For example of it is http://www.youtube.com/watch?v=9bZkp7q19f0 Next to views counter (1'167'974'545) there is an animation. But if I try to copy link or save it, it "push" into my hands useless picture. This script could be very useful on my website. How to do it?


Solution

  • As far as I can see from the code of the youtube page they use the following lines as the html elemnt for that image:

    <img class="watch-dancing-psy" src="//s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif">
    

    So normally the image referred to in the src attribute is the 1x1 pixel image.

    They use CSS to put the real image like this (when defining the CSS class watch-dancing-psy):

    background-image: url(https://s.ytimg.com/yts/img/logo_dancing_psy-vflsJl9hC.gif);