Question

I wonder if its possible to have a watermark on hotlinked images on an external site, but not on the original site? I'm using jQuery, can I do something about this?

Thanks heaps!

Was it helpful?

Solution

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/

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top