Can you disable right-click and image dragging in Galleria?
The i开发者_运维问答mages on my site are to be sold commercially and we therefore want to stop people from pinching them without paying!
If it can't be done in Galleria, any ideas how to achieve it in Javascript or jQuery?
Si
Can you disable right-click and image dragging in Galleria?
Yes. You can cancel default methods of contextmenu
and dragstart
. You can also place a transparent element over the image to block click events. See below.
The images on my site are to be sold commercially and we therefore want to stop people from pinching them without paying!
You can not stop people from getting images you place on your website. Once the user has viewed the image, it is already on their hard drive.
If it can't be done in Galleria, any ideas how to achieve it in Javascript or jQuery?
The best you can do is watermark them in a way that would take a long time to remove/hide.
As already said : it's not possible.
You can try googleing for a script that auto-resize-crop images (PHP). by doing so the images provided will be low resolution.
than you can create over all images a div with a transparent background.
Doing so any right click will actually save the 10x10 transparent .png
This works for me. (make sure you have jQuery)
// Disable right click & drag copy in Galleria
$('#galleria').bind('contextmenu', function(e){
return false;
});
$('#galleria').bind('dragstart', function(e){
return false;
});
It will be still possible to download the images anyway (Firefox => Tools => Page info).
精彩评论