Open a image with a php url (ie: domain/image.jpg.php)

I would like to mirror an image using a modified url in a forum topic that allows image tags so I can track it's visitors in cpanel stats as a normal php page.

ie: domain/image.jpg.php

`[img]http://domain/image.jpg.php[/img]`

I have tried a few aproches but none seem to work at all.

`
<?php
$url = 'http://www.tuning.aerograf.adrianmoisa.ro/1-capota-bmw-318-tunat-aerograf-3.jpg.php';
$img = '1-capota-bmw-318-tunat-aerograf-3.jpg';
file_put_contents($img, file_get_contents($url));
?>

<?php
/*$ch = curl_init('http://www.tuning.aerograf.adrianmoisa.ro/1-capota-bmw-318-tunat-aerograf-3.jpg.php');
$fp = fopen('1-capota-bmw-318-tunat-aerograf-3.jpg', 'wb');
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);*/
?>

<?php /*
$contents = file_get_contents('http://www.tuning.aerograf.adrianmoisa.ro/1-capota-bmw-318-tunat-aerograf-3.jpg');
$fp = fopen('/1-capota-bmw-318-tunat-aerograf-3.jpg', 'w');
fwrite($fp, $contents);
fclose($fp); */
?>
`

Comments

  • acrylian Administrator, Developer
    You can't include the image.php page like `http://domain/image.jpg.php` directly as it needs the Zenphoto environments. You would have to link directly to the (cached) image. Maybe this is something for you: http://www.zenphoto.org/2009/11/generate-bbcode/
  • Well... that's not exactly what I'm looking for. I need to mirror only one image which will be a custom collage made by me to be posted on over 70 forums at the advertisment boards. I wish to somehow track how many times the image was requested in order to have a good idea about how many visitors have read my topics.

    I thought that by making a subdomain which would be monitored trough Cpanel awstats I can get a prety acurate image about how many people read my ads.

    The problem is that every monitoring software that tracks my website (google analytics, cpanel awstats and trafic.ro) displays informations only about php links.

    I see that the rss feeds have a .php link and yet feedburner reads them. Also sitemap is not .xml but google has no troble with it. Can this method be aplied to .jpg files ?
  • At worst, If no method is possible, I can track how much traffic the subdomain is generating and I have an idea about how many times my image could have been requested/downloaded. Not an acurate method but it's better than nothing :D. CHecking 70 topics to see their stats would be tedious... Tooked me two days to register all of them :P
  • acrylian Administrator, Developer
    Wouldn't awstats note each request of the images, it does at least with zip files for sure (at least it did when I released the Zenpage plugin separately at first (Wow, what a task to register in 70 forums. Hopefully that pays back then..;-)).
  • I just received the first awstat report on my new subdomain. It looks like it might work out. I tells me how many hits and bandwith per file type. I guess it will sufice me :D
Sign In or Register to comment.