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

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

问题描述

我知道保护图片下载的最佳方法首先不是将其放在互联网上.

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

我认为没有 100% 的图像下载保护,如果用户可以在互联网上看到图像,他可以通过一些经验找到下载它的权限.

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.

我知道透明 .gif.png 覆盖图像或使用 background_image CSS 属性来保护它并防止右键单击下载但是有吗

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

其他使图片下载复杂化从而阻止大多数用户下载图片的方法?

以下是简单的代码:

<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.

试试这个:

$('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.

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

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.

即使我是新手,几天前我在浏览 Flickr 时尝试右键单击,它并没有让我做任何事情.这反过来是我为您提供的第一种方法.然后我试图去见检查员,在那里我什么也没找到.为什么?因为他们使用 background-image,同时他们使用 data:imagesource 作为其位置.

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.

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

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

请记住兄弟,当您让用户浏览您的网站时,您在服务器端授予他读取权限,以便他可以毫无问题地读取所有文件.图像文件的问题也是如此.他可以读取图像文件,然后可以轻松地保存它们.他在浏览您的网站时首先下载图像.因此,将它们保存在磁盘上对他来说没有问题.

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天全站免登陆