How to prevent downloading images and video files

2019-01-02 16:05发布

How to prevent downloading images and video files from my website? Is it possible? What would be the best way to do this?

24条回答
梦该遗忘
2楼-- · 2019-01-02 16:19

Insert a transparent gif 1px x 1px just inside the <body> tag:

<body><img src="route-to-images/blim.gif" class="blimover">

Then style it with this:

.blimover {
  width: 100% !important;
  height: 100% !important;
  z-index: 1000 !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
}

This will remove any click functionality from a page, but it sure stops people stealing any content!

You can apply the same to a <div>, <section>, <article> etc, just name accordingly and prevent your copy and/or images being ripped.

Nothing stops a screengrab though ... ...

查看更多
旧时光的记忆
3楼-- · 2019-01-02 16:20

You can't stop image/video theft but you can make harder for normal users but you can't make it harder for the programmers like us (I mean thieves that know little web programming).

There are some tricks you can try:

1.) Using flash as YouTube and many others sites like http://www.funnenjoy.com does.

2.) Div overlaping or background pic setting (but users with little sense can easily save all resources by opening inspect element or other developer option).

3.) You can disable right click and specific keys like CTRL + S and others possibles with JavaScript but main drawback is that if user disable JavaScript our all tricks fail down.

4.) Save image in none online directories (if you have full access to web server) and read that files with server side languages like PHP every time when image / video is required and change image id time to time or create script that can automatically change ID after every access.

5.) Use .htaccess in apache to prevent linking of your images by others sites. you can use this site to automatically generate .htacess http://www.htaccesstools.com/hotlink-protection/

查看更多
流年柔荑漫光年
4楼-- · 2019-01-02 16:21

Images must be downloaded in order to be viewed by the client. Videos are a similar case, in many scenarios. You can setup proxy scripts to serve the files out, but that doesn't really solve the issue of preventing the user from getting their own copy. For a more thorough discussion of this topic, see the question How can I prevent/make it hard to download my flash video?

查看更多
无与为乐者.
5楼-- · 2019-01-02 16:22

In standard HTML, I don't know of anyway.

You didn't really say, but I'm guessing you are having problems with people deep linking into your content. If that's the case, and you are open to server side code, I believe this might work:

  1. Create a page that accepts a numeric id, maps it to a server file path, opens that file, writes the binary directly to the response stream.
  2. On the page request, generate a bunch of random ids, and map them to the actual media urls, and store that mapping object server side somewhere (in session?) with a limited life.
  3. Render your pages with your media links pointing to the new media page with the appropriate id as a query string argument.
  4. Clear the mapping object and generate all new links on every postback.

This :

  1. won't stop people from downloading from within your page
  2. definitely isn't as lightweight as standard HTML
  3. and has it's own set of issues.

But it's a general outline of a workable process which might help you prevent users from deep linking.

查看更多
心情的温度
6楼-- · 2019-01-02 16:22

Put your image or video in flash format. Works great.

查看更多
看风景的人
7楼-- · 2019-01-02 16:23

It also doesn't hurt to watermark your images with Photoshop or even in Lightroom 3 now. Make sure the watermark is clear and in a conspicuous place on your image. That way if it's downloaded, at least you get the advertising!

查看更多
登录 后发表回答