I’m trying to display an image from the data store using the hello
world sample. When I run the code below I get a blank image displayed
in FireFox. I'm sure the image is uploaded because when I initially
tried {{ greeting.pic1|escape }} in the html file I got a bunch of
garbage back.
Can someone pls let me know what i'm doing wrong.
class Greeting(db.Model):
author = db.UserProperty()
date = db.DateTimeProperty(auto_now_add=True)
pic1 = db.BlobProperty()
class GetImage(webapp.RequestHandler):
def get(self):
query_str = "SELECT * FROM Greeting ORDER BY date DESC LIMIT
10" result[0]
self.response.headers['Content-Type'] = 'image/jpg'
self.response.out.write(result.picture)
application = webapp.WSGIApplication(
[('/upload/', MainPage),
('/upload/sign', Guestbook),
('/pic', GetImage)],
debug=True)
----------HTML-----------
{% for greeting in greetings %}
<img src="/pic?author={{greeting. author}}"></img>
{% endfor %}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" 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/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---