Question

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!

Was it helpful?

Solution

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.

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