Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2013-11-15 08:52:27
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,331
copyprotection of images
client wants to protect its photos on a site for downloading/saving. what are the best, the easiest ways to do that? what you suggest?
Offline
#2 2013-11-15 09:49:53
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,331
Re: copyprotection of images
found this javascript from here
<script type="text/javascript">
<!-- Disable
function disableselect(e){
return false
}
function reEnable(){
return true
}
//if IE4+
document.onselectstart=new Function ("return false")
document.oncontextmenu=new Function ("return false")
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
//-->
</script>
it disables right click on whole page, but i would prefer to disable right click only on photos. could anybody help me here?
Last edited by Gallex (2013-11-15 09:56:48)
Offline
Re: copyprotection of images
Hi Gallex, there is no way to protect as any javascript disabled browser would easily bypass any restriction – not to mention that anyone could take a screenshot. I was given some good advice – by Jukka if I remember correctly – somewhere in this forum: “If you don’t want it to be copied, don’t put it on the net”.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#4 2013-11-15 10:20:35
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,331
Re: copyprotection of images
colak wrote:
Hi Gallex, there is no way to protect as any javascript disabled browser would easily bypass any restriction – not to mention that anyone could take a screenshot.. I was given some good advice – by Jukka if I remember correctly – somewhere in this forum: “If you don’t want it to be copied, don’t put it on the net”.
this is not an opion ;)
and i know there is no bullet-proof solutions. but most of visitors are not so clever. and just …to make it little bit uncomfortable for copiers
Offline
Re: copyprotection of images
Is watermarking the photos an option?
The problem with disabling right-clicking and contextual menus is that it stops users from doing legitimate tasks that require that functionality, e.g. opening links in a new tab/window. In my opinion the negative impact on usability and user experience for all users of such things is likely to much more harmful to a business than that suffered from the minority of visitors that will attempt to steal photos for their own use.
Let’s face it, you can’t stop someone from viewing source and directly opening the images in their own windows without any of the accompanying HTML or javascript.
As Colak rightly says, don’t put anything online that you aren’t happy being in the public domain.
Offline
Re: copyprotection of images
If you can see the image in the browser you had it already downloaded (copied). It’s essential.
The only thing you can do is teaching your client how the »internet« is working.
Last edited by trenc (2013-11-15 11:33:05)
Digital nomad, sailing the world on a sailboat: 32fthome.com
Offline
#7 2013-11-15 11:51:30
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,331
Re: copyprotection of images
guys, i know all that and i have been counted on it .
but still, could anybody write to me modified code from my previous post? disabling right click only on photos
Offline
Re: copyprotection of images
A quick Google gives me these options:
- Disabling right click on images using jquery
- Disable right click context menu on images
- No Right Click!
Plus this article from Sitepoint that your client really ought to read!
Offline
#9 2013-11-15 12:06:58
- uli
- Moderator

- From: Cologne
- Registered: 2006-08-15
- Posts: 4,316
Re: copyprotection of images
You can offer the normal click experience when you layer a transparent one-pixel-gif on top of the image you want protected and stretch the gif to take the underlying image’s dimensions.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: copyprotection of images
CSS pointer-events: none; is a nice alternative in modern browsers, but it will disable left clicks too.
Offline
Re: copyprotection of images
On a recent project, TXP based, I use a transparent gif above all images positioning with CSS (which is a better solution than some javascript) in order to protect drag & drop effects. This kind of method is used by flikr, too.
For better protection, all images are created with a watermark on the fly. See in action here
If you’re interested, send me an email.
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
Re: copyprotection of images
uli wrote:
You can offer the normal click experience when you layer a transparent one-pixel-gif on top of the image you want protected and stretch the gif to take the underlying image’s dimensions.
^^ This. Also, make a div the same size as the image, set the image as the background and stretch a 1px transparent GIF over it if you want to be sneaky.
Of course, any browser inspector will see the background image loaded and the URL will be visible. This can also be used to find the source files on streaming media sites, if that’s something that interests you.
Online
Re: copyprotection of images
gaekwad wrote:
Also, make a
divthe same size as the image, set the image as the background and stretch a 1px transparent GIF over it if you want to be sneaky.
That is actually not a great idea, if you care about performance. Background images load with a much lower priority, and secondly, more and more, browsers use some preloading techniques & heuristics to attempt to fetch content images faster (matters on mobile devices even more) – that is images referenced in an img element.
The trick illustrated by Pat64 is probably the less annoying one (might still be a little disturbing for those who use assistive technologies, this could be mitigated by using aria-hidden=true for the transparent overlay image).
Hmm come to think of it, Pat64’s technique could be improved by using an empty span, sized to and overlaying the image, with a transparent background (background: rgba(0,0,0,0)). One less network call.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
Re: copyprotection of images
Hi Philippe :)
A very interesting point of view. aria-hidden="true" role="presentation" are still used (my primary attempt to leave alt text attributes empty), but changing transparent 1×1px gif by a span is a good, clever solution. I changed the markup of the website I mentioned above. Thanks ;)
Cheers,
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
#15 2013-11-18 10:39:18
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,331
Re: copyprotection of images
i guess, those last solutions won’t protect for steeling if user chooses “save page as…” from browser’s menu?
Offline