Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display image in Python-cgi

I am beginner and i dont know where i am doing mistake. i have seen these stack posts Return an image to the browser in python, cgi-bin , Return Image from python CGI using javascript and How to loading/show a picture in a Python CGI page but got no help.

Here is the code:

#!C:\Python27\python

text = """Content-type: text/html\n

<TITLE> CGI 101 </TITLE>
<H1>A SECOND CGI SCRIPT </H1>
<HR>
<P> HELLO,CGI WORLD!</P>
<img src="../imag000.jpg" width=101 height=64 border=0 alt="">
<HR>
"""

print (text)

and on browser it appears small box which is not showing image, like this:

enter image description here

Kindly help.

and folder which contains image is cgi. Kindly see picture:

enter image description here

like image 786
user3440716 Avatar asked Aug 07 '26 22:08

user3440716


1 Answers

Here is the best Solution:

<img src="http://localhost/imag000.jpg" width=101 height=64 border=0 alt="">
like image 123
user3440716 Avatar answered Aug 10 '26 10:08

user3440716



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!