I have this php code (image.php):
if($_SERVER['SERVER_NAME'] == 'site.tld') {
header('Content-type: image/jpeg');
echo file_get_contents("image1.jpg");
} else {
header('Content-type: image/jpeg');
echo file_get_contents("image2.jpg");
}
*This page (image.php) is hosted on site.tld;
Now... This code will be called by <img src='http://site.tld/image.php' />.
I'd like to dispay image1.jpg if image is called on site.tld and image2.jpg if not.
That code displays image1.jpg whatever domain name where code is called.
Any solutions ? Thanks.
Edit: The output of $_SERVER['SERVER_NAME'] is site.tld (my server) on any websites...
That's the problem because the script not works properly.
imagecreatefromjpeg