Forum Moderators: coopster
...
the reason is that i want to do a database update if this image has been called by the client,
i realise i could get this from the server logs but i don't want to do it that way
- basically i want to check that the 'user' is requesting the image that is in the html page.
the first stage is relatively easy:
i enter a line in .htaccess that rewrites the image call to the .php page.
RewriteRule ^imagetest/1234\.jpg$ processimage.php?imageID=1234 [R]
(this is a rule for just one image, i would use a regular expression in the working case)
....
so the processimage.php page would do something like (pseudo code)...
1. get the imageID value
2. update the database to show that this image id was requested
3. send an image back to the client
it is this third step that i am stuck on ... how can i do this?
For example:
# headers here
header("Content-Type: image/gif");
etc...
#
[url=http://www.php.net/readfile]readfile[/url]('/path/to/image.gif');