nebest
asked on
Using Perl to Display Picture
my directory structure is /home/p/public_html/cgi-bi n/
I am trying to display a pic (using perl)outside of public_html ... I tried doing
header ('image/gif');
print "<IMG SRC=\"/home/p/pic.gif\">";
but when i render it i realise it is looking for the picture at www.servername.com/home/p/pic.gif
and i guess since it doesn't have permission for /home/p it just diplays the red x.
How can i solve this problem?
Thanks
I am trying to display a pic (using perl)outside of public_html ... I tried doing
header ('image/gif');
print "<IMG SRC=\"/home/p/pic.gif\">";
but when i render it i realise it is looking for the picture at www.servername.com/home/p/pic.gif
and i guess since it doesn't have permission for /home/p it just diplays the red x.
How can i solve this problem?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I tried using the suggestion by Tintin and I get a bunch of garbled text printed to screen ... what do i need to do to convert it to an actual image.
What browser are you using? Have you opened the image directly in the browser previously?
ASKER
I am using internet explorer. I can open the image perfectly directly when its in public_html. I know its reading the image file, can you give me an idea why i would see garbled data rather than pic. is there some header i may not be including?
ASKER
The code you sent works perfectly, thank you... I guess it has something to do with the fact that I am also printing text data in the same perl script. I just tried using your code without any other code and it works.
Thanks for your help
Thanks for your help
You can't mix content types (as you found out).
Your HTML may also be set up to define a base reference point of /home/p/public_html