The following works:
imagePath = '/static/'
imageName = 'moreBlah.jpg'
web.render("content-type", "image/jpeg")
print "<img src='%s'>" % ImagePath + ImageName
Good to know about print "<img src='%s'>". Thanks!
ps Wish there was a place to keep these small but important nuggets
of knowledge somewhere central eg. in the tutorial or in a tips and
tricks section. Other recent useful stuff included the note from Jac
about folder/directory structure, and the use of "/static/" folders to
hold all static files ie. the folder name is hard-coded in the webpy
code as 'static'!
On Feb 24, 7:39 pm, jac <[EMAIL PROTECTED]> wrote:
> Have you tried setting the content type?
>
> On Feb 24, 7:42 pm, dineshv <[EMAIL PROTECTED]>
> wrote:
>
> > I want to display images on a web page. All the (*.jpg) image files
> > are in the /static/ folder. The following code:
>
> > > imagePath = 'C:/blahBlah/static/'
> > > imageName = 'moreBlah.jpg'
> > > print open(imagePath + imageName, "rb").read()
>
> > prints out gibberish.
>
> > Also tried:
>
> > > imagePath = '/static/'
>
> > and that results in a File Not Found error.
>
> > Any thoughts?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---