Forum Moderators: coopster
<?php
include($_GET["image"]);
?> do you have any suggestions how something like this works professionally?
thanks in advance!
ps: the php file DOES NOT GENERATE the image!
it's simply a wrapper that can be used to prevent displaying the image if its referer is not wanted, for example, ...
$Image = $_GET['Image']; // you can strip out bad characters here
if (!file_exists($Image))
{
// Do something to show a "no image" error or something
}
list(,,$ImageType) = getImageSize($Image); // get image type
switch($ImageType) // Determine Content-Type for header
{
case 1:
$ContentType = "image/gif";
break;
case 2:
$ContentType = "image/jpeg";
break;
case 3:
$ContentType = "image/png";
break;
}
header("Content-Type: $ContentType"); // send header
@readfile($Image); // output file