<div><img src="/image?img_id={{ greeting.key }}" alt"No Image" /></div>

You cant display the image itself because it would look like that, instead
you create an Image class which reads a key and displays the image as an
image with a png header.

2008/9/29 lazer <[EMAIL PROTECTED]>

>
> Hi,
>
> I can upload user image by code:
> http://code.google.com/appengine/docs/images/usingimages.html#Uploading
>
> class Guestbook(webapp.RequestHandler):
>  def post(self):
>    greeting = Greeting()
>    if users.get_current_user():
>      greeting.author = users.get_current_user()
>    greeting.content = self.request.get("content")
>    avatar = self.request.get("img")
>    greeting.avatar = db.Blob(avatar)
>    greeting.put()
>    self.redirect('/')
>
> And I can display this image by code:
> http://code.google.com/appengine/docs/images/usingimages.html#Serving
>
> class Image (webapp.RequestHandler):
>  def get(self):
>    greeting = db.get(self.request.get("img_id"))
>    if greeting.avatar:
>      self.response.headers['Content-Type'] = "image/png"
>      self.response.out.write(greeting.avatar)
>    else:
>      self.error(404)
>
> But I don't know how to display this image using the template html
> file.
> I try the flowing code: <div>{{ greeting.avatar }}</div> but the
> browser display ����� JFIF�   �…..
>
> Thinks
> >
>


-- 
Best Regards.
fedekun

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to