We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,301 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

image not showing in web browser

i using this code for making a page but the images are not showne in web browser win i deploy the script


please help.....

def get(self):
     self.response.out.write(""" <html>
                                    <head>
                                     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                                     <title>my page</title>
                                     <link href="stylesheet.css" rel="stylesheet" type="text/css" />
                                   </head>
                                   <body>
                                   <h1>my page</h1>
			     """)
    
f_path=os.path.join (os.path.dirname (__file__),'\image')
self.response.out.write (" <div><img src=\"" + os.path.join(f_path,"media.jpg")+'\"'+ """ align="absmiddle" vspace="1" width="144" height="192" hspace="1" /></div>""")
self.response.out.write (" <div><img src=\"" + os.path.join(f_path,"main.jpg")+'\"'+ """ align="absmiddle" vspace="1" width="72" height="96" hspace="1" />"""+ " <img src=\"" + os.path.join(f_path,"main.jpg")+'\"'+ """ align="absmiddle" width="72" height="96" vspace="1" hspace="1" /></div> """)
self.response.out.write ("""</body>
                               </html>""")
2
Contributors
1
Reply
6 Days
Discussion Span
1 Year Ago
Last Updated
2
Views
akshay.nikhare
Newbie Poster
1 post since Feb 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

It looks like f_path may be referencing the absoloute path to your images, rather than the path from the web root, so when the browser requests them you're getting the original absoloute path plus the web root, causing the images not to be found.

joehms22
Junior Poster
114 posts since Jan 2010
Reputation Points: 28
Solved Threads: 21
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0702 seconds using 2.8MB