保护图像下载 [英] Protect image download

查看:96
本文介绍了保护图像下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我认为保护图片下载的最佳方法不是放在互联网上。

我假设没有100%如果用户可以在互联网上看到一个图像,他可以用一点经验找到访问来下载它。



我知道透明。覆盖图像或使用 background_image CSS属性来保护它,并防止出现这种情况的gif .png 右键点击下载,但是有

其他方式使图片下载变得复杂,因此阻止了大多数用户的图片下载。



这是一个 FIDDLE ,代码以:

 < img src =http://placekitten.com/600/450> 


解决方案

实际上没有办法防止用户做一个特定的任务。但你可以随时采取措施!



第一种方法

图像共享网站有一个巨大的开发人员日夜工作团队来创建一个算法来防止用户保存图像文件。

尝试:

  $('img')。mousedown ){
if(e.button == 2){//右键单击
return false; //不做任何操作
}
}

因此,用户将无法从菜单中单击另存为...选项,反过来,他不会有机会保存图片。



第二种方法



其他方式是使用 background-image 。这样,用户将无法右键单击并将图像另存为...但他仍然可以在检查器中查看资源。



第三种方式



即使我是新的,几天前我冲浪Flickr当我试图右键单击,不让我做一件事,这反过来是我提供给你的第一个方法,然后我试着去看看督察,我没有发现什么。为什么?因为他们使用 background-image ,同时他们使用 data:imagesource 作为它的位置。



这对我来说也是惊人的。您可以防止用户以这种方式保存图像文件轻松。



它被称为数据URI计划: http://en.wikipedia .org / wiki / Data_URI_scheme



注意



请记住兄弟,一个用户冲浪你的网站,你给他在服务器端的权限,所以他可以读取所有的文件没有任何问题。同样是图像文件的问题。他可以读取图像文件,然后他可以轻松地保存它们。他在上网时首先下载图片。所以,他没有一个问题,将他们保存在他的磁盘上。


I know the best way to protect image download is not putting it on internet in the first place.

I assume there is no 100% protection against image download and that if a user can see an image on internet he can with a bit of experience find access to download it.

I am aware of transparent .gif or .png covering the images or using background_image CSS property to protect it and prevent right click download but are there

other ways to complicate image download and therefore prevent image download by most users?

Here is a FIDDLE with code to start with :

<img src="http://placekitten.com/600/450">

解决方案

No there actually is no way to prevent a user from doing a particular task. But you can always take measures! The image sharing websites have a huge team of developers working day and night to create such an algorithm where you prevent user from saving the image files.

First way

Try this:

$('img').mousedown(function (e) {
  if(e.button == 2) { // right click
    return false; // do nothing!
  }
}

So the user won't be able to click on the Save Image As... option from the menu and in turn he won't get a chance to save the image.

Second way

Other way is to use background-image. This way, the user won't be able to right click and Save the Image As... But he can still see the resources in the Inspector.

Third way

Even I am new to this one, few days ago I was surfing Flickr when I tried to right click, it did not let me do a thing. Which in turn was the first method that I provided you with. Then I tried to go and see the inspector, there I found nothing. Why? Since they were using background-image and at the same time they were using data:imagesource as its location.

Which was amazing for me too. You can precvent user from saving image files this way easily.

It is known as Data URI Scheme: http://en.wikipedia.org/wiki/Data_URI_scheme

Note

Please remember brother, when you're letting a user surf your website you're giving him READ permissions on the server side so he can read all the files without any problem. The same is the issue with image files. He can read the image files, and then he can easily save them. He downloads the images on the first place when he is surfing your website. So there is not an issue for him to save them on his disk.

这篇关于保护图像下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆