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

4 posts / 0 new
Last post
#1 Mon, 08/24/2009 - 03:40
Anonymous

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

Hi,

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:

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 ?

Thanks

Mon, 08/24/2009 - 08:40
andreychek

Howdy,

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.

-Eric

Mon, 08/24/2009 - 09:40
Davvit

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 ?

Mon, 08/24/2009 - 10:42
ronald
ronald's picture

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

Topic locked