English 中文(简体)
Serving a text link to a hotlinked image?
原标题:

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!

问题回答

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.





相关问题
Which non-bold UTF-8 iPhone SDK font can I use here?

Problem: I create a UILabel with this font: label.font = [UIFont systemFontOfSize:15.0f]; Now this system font is bold, but I want to display pretty small text, and the text may also contain very ...

Limiting file upload type

Simple question. Is there a way to only allow txt files upon uploading? I ve looked around and all I find is text/php, which allows PHP. $uploaded_type=="text/php

Extract everything from PDF [closed]

Looking for solution to extract content from a PDF file (using console tool or a library). It will be used on server to produce on-line e-books from uploaded PDF files. Need to extract following ...

Flash & external form fields

Does anybody know if this is possible? I am trying to create a flash movie that will show / preview what I am typing into a field in a normal HTML form. The call to update the flash movie would most ...

Avoiding escape sequence processing in ActionScript?

I need to mimic C# functionality of the @ symbol when it precedes a string. @"C:AFilePath" for example What is the best way to do this? Also there are some sites that will escape larger ...

iPhone: Draw rotated text?

I want to draw some text in a view, rotated 90°. I m pretty new to iPhone development, and poking around the web reveals a number of different solutions. I ve tried a few and usually end up with my ...

Numbering in jQuery

How could I change the text below so that the text within it has a number appended to it. <div class="right">This is some text</div> <div class="right">This is some text</div>...

热门标签