提供指向热链接图像的文本链接?
我正在尝试创建某种热链接保护系统。我想使用我的热链接图像作为广告手段。最初我想在上面打印特定图像的 URI,但由于其长度各不相同,正确打印它似乎需要太多努力。我现在正在研究打印图像及其下方的文本链接或仅文本链接的可能性。
我想我以前见过这个,但我不知道该怎么做。我四处搜寻但找不到任何帮助。有人可以帮助我或指出教程或其他东西,以在热链接图像上显示文本吗?
谢谢!
I am trying to create some sort of hotlink protection system. I want to use my hotlinked images as an advertising means. Initially i thought printing the URI of the specific image on it, but because the length of this varies, printing it correctly appears to need too much effort. I am now looking into the possibility of printing the image and below it a text link, or just the text link.
I think i had seen this before, but i'm not sure how to do it. I searched around but couldn't find any help. Can someone help me out or point to a tutorial or something, to display text on hotlinked images?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想保护图像,最好在图像上创建水印。但水印的问题在于它们会降低视图的体验,尤其是当它们很引人注目时。
如果您想直接拦截对您网站的图像请求,您可以添加热链接保护。
如果您的主机有 cPanel,这里有一个关于如何设置盗链保护的教程使用 cPanel 在您的网站上。
但听起来您想在热链接图像上使用自定义文本“推出您自己的”。为此,您需要拦截图像请求。如何执行此操作取决于您的主机是基于 Windows 还是基于 Linux。基于 Linux,您可以使用 .htaccess 文件将图像请求重定向到您选择的脚本。在 Windows 中,我不确定如何做到这一点(也许其他人可以详细说明?)。
这是使用 htaccess 阻止热链接的教程。
在上面的教程中,它向您展示了如何将对图像的请求重定向到静态链接,但在您的情况下,您可以将它们重定向到脚本或不同的隐藏目录(例如 /image.jpg 将返回 /hotlinked/imageWithText.jpg) ,会有文本叠加。
如果您需要动态文本,那么您可以将请求重定向到您最喜欢的 Web 服务器脚本,例如 Perl、PHP 等,然后该脚本将加载图像并添加文本覆盖。
小心。
You may be better off creating a watermark on the image if you want to protect your images. The problem though with watermarks is that they detract from the view's experience, especially when they are obtrusive.
If you want to intercept requests to your website directly to your image you can add hotlink protection.
If your host has cPanel here is a tutorial on how to setup Hotlink Protection on your website using cPanel.
But it sounds like you want to 'roll your own' with custom text over your hotlinked image. To do that you'll need to intercept the image requests. How you do that will depend on if your host is Windows or Linux based. With Linux based you can use your .htaccess file to redirect image requests to a script of your choosing. In Windows, I'm not sure how to do it (perhaps someone else can elaborate?).
Here is a tutorial on using htaccess to stop hotlinking.
In the above tutorial it shows you how to redirect requests to your images to a static link, but in your case you can redirect them to a script or a different hidden directory (e.g. /image.jpg would return /hotlinked/imageWithText.jpg), that would have text overlay.
If you need the text to by dynamic then you can redirect the request to your favorite web server script like Perl, PHP, etc. that will then load the image and add the text overlay.
Take care.