开发者

Watermark on hotlinked images?

I wonder if its possible to have a watermark on hotlinked images on an external sit开发者_开发知识库e, but not on the original site? I'm using jQuery, can I do something about this?

Thanks heaps!


This is not possible through a client-side technology. You will need to go server based.

If you have access to a server side technology, such as ASP.NET; you could expose all of your images through an ashx handler. This would let you display a water mark on some images, or not display images at all depending on the source.

Here's a great article on writing ashx handlers for images -- http://dotnetperls.com/ashx-handler/ https://web.archive.org/web/20160311222240/http://www.dotnetperls.com/ashx-handler

If you are using a *nix based server, @Jojo has some links for using php to similar effect.

After writing such a handler in ASP.NET or php, you'll need to check the HTTP Referer to see if it is a page on your site, or a third party site and then do the necessary image processing to produce your watermakr effect.


You would need to check that the referrer HTTP header matches your site's domain prior to running the watermarking code to determine whether a watermark is required.


You can't do that with JQuery, since it is not at all involved when the image is served via hotlink. You'll need to do it server-side.


You would have to do something on the back-end to add a watermark to hot-linked images.

Check out this article if you have access to PHP.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜