質問

I am writting a G-WAN application, which will count the number of visit for different images (the images are stored on different servers).

HTML code:

<img src = "http://example.com/?sendandcount"></img>

For the sendandcount application, after I count and record the visitor detail, I try to return an image URL like "http://abc.com/test.jpg", but it doesn't work! The "img src" tag seems to request and identify the image content only...

Do I need to get all the images from other servers first and delivery under from the gwan server? (It will cause inconsistencies as these images will change as time goes...)

Any suggestion? Thank you very much!

役に立ちましたか?

解決

You can't send a string back. You need to send the image itself. When the IMG tag source is looked up by a browser, the browser expects to receive back a file.

The easiest way to do this from your application is by a URL redirection.

Otherwise, you'd have to output the relevant MIME headers and send the file data yourself. This is only necessary if you're doing things like dynamically watermarking or resizing an image, or if the image is not publicly available.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top