Is there a way to easily record an image download count ?


I am giving clients an image to use as a kind of “trust seal” and I want
to record the number of times it is displayed, I beleive that I can do this
by using PHP GD for the image creation, but someone said that it would be easier
by tracking dirctly on the server.

This is what I mean:

I will give a client this code to place on their website:

PHP Code:

<a href=“$sup_id”
onclick=“NewWindow(this.href,’’,‘800’,‘600’,‘yes’,‘default’); return false”
onfocus=“this.blur()” >
<img src=“”
alt=“Membership Click to Verify - Before you Buy”
border=“0” >

Now I will be recording the number of times the image is clicked
on, BUT I also want to record the number of times that the
image is downloaded from my website. (ie displayed on a website)

Any idea how I might do this ?



Well, you can always use a cron job once a day (or whatever frequency you prefer) to look in the Apache access logs, and see how frequently a given URL is accessed.

Also, if you’re using PHP to generate the image, you could call out to a database while the image is being generated, and store some information in MySQL (or whichever database you prefer) regarding the image and who is clicking it.


Hi Eric,

Thanks for your reply,
It has been recommended that I use PHP to generate the image and then do the logging to a database as you say.

The thing is, I have a ready image that I was going to use.

Does creating an image on the fly with PHP cause much of a drain to the server - as opposed to
just serving up an existing image ?

Does creating an image on the fly with PHP cause much of a drain to the server
No not really, the seal you talk about is like 3kb? Much like anti-spam images right?

Some sites use GD to create images of text in certain non-web compliant typefaces.
I foresee issues with too large images and 1000’s of simultaneous requests