OK, so I want to see how many views I am getting on my ad on Craigslist to sell my guitar amp.
Craigslist lets you put in HTML and you can call images from your own host into your ad.
How would I use the image source to trigger a count on my server other that watching the log files. I'd rather have a script get triggered and write to a DB table when the image loads.
I found a tutorial on Zend about generating a counter image and doing this, but I don't want to generate, I want to display a picture of my amp.
What do you think?
Thanks,
- D
PHP page counter from image src
Moderator: General Moderators
Put this in the HTML
Have somescript.php log the hits and return the image you want displayed.
By "return the image" I mean it has to output the proper headers and send the actual contents of the file.
I imagine the Zend tutorial has a complete example of how to send the image.
Code: Select all
<img src="http://yourhost.com/somescript.php">By "return the image" I mean it has to output the proper headers and send the actual contents of the file.
Code: Select all
$fh=fopen('myimage.jpg','r');
header("Content-type: image/jpg");
// more headers might be needed ???
filepassthru($fh);