dineshv 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?
The "gibberish" you see is binary data interpreted as html in whatever
encoding it might guess. You need to send the correct mime-type
("content-type: image/jpeg" in this case) for the browser to know that
it is a jpeg encoded image.
b^4
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---