热链接图像上有水印吗?

发布于 2024-08-08 16:45:01 字数 83 浏览 6 评论 0原文

我想知道是否可以在外部站点上的热链接图像上有水印,但在原始站点上却没有水印?我正在使用 jQuery,我可以对此做些什么吗?

多谢多谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

清引 2024-08-15 16:45:01

通过客户端技术这是不可能的。您将需要基于服务器。

如果您可以使用服务器端技术,例如 ASP.NET;您可以通过 ashx 处理程序公开所有图像。这可以让您在某些图像上显示水印,或者根本不显示图像,具体取决于来源。

这是一篇关于为图像编写 ashx 处理程序的精彩文章 -- http://dotnetperls.com/ashx-handler / https ://web.archive.org/web/20160311222240/http://www.dotnetperls.com/ashx-handler

如果您使用的是基于 *nix 的服务器,@Jojo 有一些使用 php 进行类似操作的链接影响。

在 ASP.NET 或 php 中编写此类处理程序后,您需要检查 HTTP Referer 以查看它是否是您网站或第三方网站上的页面,然后进行必要的图像处理以产生水印效果。

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.

酒解孤独 2024-08-15 16:45:01

在运行水印代码之前,您需要检查引荐来源网址 HTTP 标头是否与您网站的域匹配,以确定是否需要水印。

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.

幸福%小乖 2024-08-15 16:45:01

您无法使用 JQuery 执行此操作,因为当通过热链接提供图像时,它根本不涉及。您需要在服务器端执行此操作。

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.

半暖夏伤 2024-08-15 16:45:01

您必须在后端执行某些操作才能为热链接图像添加水印。

如果您可以访问 PHP,请查看本文

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文