Entry
How do I include a .jpg (from outside the web srvr docs dir) in a page with other html content?
Mar 15th, 2008 22:09
dman, ha mo, Articles Hosting, Jonathan Sharp, Barry Prentiss, http://www.ttnr.org
Have a PHP script print out a header(); call with the correct image
header (gif, jpg etc), and then do a read("path/to/file.jpg");
Be very careful if you're passing a variable to the read function from
user input. Such as myphpscript.php?file=bob.jpg as this would be
considered "tainted" data and someone could possibly try
myphpscript.php?file=/etc/passwd
It's best to have the path to the file stored in a database and only
pass an ID to the script.
But going back to your origional question, read() is binary safe so
you
can just print the header and spit the contents of the file to the
browser. All your img tags on in your html would be <img
src="myphpscript.php?file=image2">
=====
bugs.php.net/37467
i hope that helps: