Reputation: 995
I have built my website in a way so that the actual database files are positioned as follows
root/
root/httpdocs <- public folder
root/databasefolder/actual_files_here/some_photo.jpg
How can I implement so that the php can view/load a photo from that databasefolder and echo it with tag. I simply tried "../databasefolder/"
in a tag, but it doesn't work (of course it doesn't), since it's from hidden folder.
I tried Base64 which works in other browsers, but not with Internet Explorer, due to that silly kb limit.
Upvotes: 3
Views: 1550
Reputation: 847
In your HTML:
<img src="image.php?image=some_photo.jpg" />
And a php script that echoes your image.
header('Content-type: image/jpeg');
echo imagejpeg('root/databasefolder/actual_files_here/' . $_GET['image']);
You can use the get parameter "image" to load whatever image you need from that folder.
Upvotes: 2