Should I read an image (with php) and then echo it while grabbing the header? Or there is another way?
+1
A:
You want referrer information of an external image? That should always be whatever your server sends.
However, if you are talking about having an image file on your server that should get referrer information, you could do
<?php
// Possibly use mod_rewrite so point your image here
$referrer = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : NULL;
// Save the referrer somewhere
header('Content-Type: image/png');
readfile('image.png');
alex
2010-10-12 05:08:46
`readfile()` outputs file itself and returns number of bytes. No `echo` is necessary.
zerkms
2010-10-12 05:12:34
@zerkms Thanks, will make an edit.
alex
2010-10-12 05:40:09