I'm generating an image using several PHP image routines:
imagecreatefrom jpeg, imagejpeg, etc. The PHP file containing these
routines is meant to be included on web pages just like regular
images, such as: <img src="image.php" >. So far, all this works
beautifully.
Where I'm stuck is that I'd like to keep other web sites from
including my image on remote web pages. I want the image to only
display when rendered on pages from my web server. I would like to
detect for any "remote" condition and then serve up an alternate
image. I have the code for this part, too, but I don't know what
condition to watch for.
I'm thinking something along the lines of using $HTTP_REFERER or
$SERVER_NAME, but can't seem to figure out how to make it work. The
image.php file will always detect that it's being run from my server.
It's the context that I would like to detect.
Thanks for any tips!!
imagecreatefrom jpeg, imagejpeg, etc. The PHP file containing these
routines is meant to be included on web pages just like regular
images, such as: <img src="image.php" >. So far, all this works
beautifully.
Where I'm stuck is that I'd like to keep other web sites from
including my image on remote web pages. I want the image to only
display when rendered on pages from my web server. I would like to
detect for any "remote" condition and then serve up an alternate
image. I have the code for this part, too, but I don't know what
condition to watch for.
I'm thinking something along the lines of using $HTTP_REFERER or
$SERVER_NAME, but can't seem to figure out how to make it work. The
image.php file will always detect that it's being run from my server.
It's the context that I would like to detect.
Thanks for any tips!!
Comment