|
Posted by Good Man on 04/17/07 19:33
Jerry Stuckle <jstucklex@attglobal.net> wrote in
news:4e-dnSRy5N3bZbnbnZ2dnUVZ_qiqnZ2d@comcast.com:
> You could do something like create a php file which serves the images
> from the other folder, but that's the hard way.
You can make it all fancy-like, or simple.... depending on what you
need. But if you have the GD library and you're set on keeping images
above the webserver, you can do something like this... I'll call this
file "imagedisplay.php";
<?php
/*
if you wanted, you could have the database figure out which image to get
based on a 'file key' or something, or another db call... for this
example, i'm putting the image name right in the code.
*/
$vImg = "donut.jpg";
header("Content-type: image/jpeg");
if(file_exists($vImg)) {
$img_handle = imagecreatefromjpeg($vImg) or die("");
ImageJpeg($img_handle);
}
?>
Voila.
In your code, it's just:
<img src="imagedisplay.php?vKey=xyydjaj" alt="My Image" />
Navigation:
[Reply to this message]
|