Reputation: 66
I want counter hit increment i.e. to be save in database, Whenever a perticular image will preview on site/server.
For Eg: http://test.com/1234(ad_no)/1.jpg whenever this url going to load on site hit counter code should increase.But not in brower, like following code in html view not html source.
<div align="center"><center><table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="75%;"><tbody><tr><td width="100%;"><a href="http://www.test.com/27123"> <img border="1" src="http://www.test.com/27123/1.jpg" width="720" height="541" /></a></td></tr></tbody></table></center></div>
Upvotes: 1
Views: 763
Reputation: 1324
Instead of using <img src="image.png" alt="Image"/>
use this:
<img src="load_image.php" alt="Image"/>
Now at load_image.php use the following code:
<?php
//Connect mysql server
....
//Update your count
....
//Return the image
$image = file_get_contents('location/myimage.png');
header('content-type: image/png');
echo $image;
?>
It will first execute the php and then simply return the image file required. So this way you can keep a track of how many times that image was requested. This is the way most tracking pixels work.
Upvotes: 2
Reputation: 50976
you want to log showing of your image from another server?
You could do it with
Upvotes: 0