Hello all,
I have recently started working with app engine. Now i'm trying to
generate and display image dynamically using PIL and datastore. I
tried to create something very basic to start off with but already hit
a wall. here are some code snippets
<SNIP>
from google.appengine.ext import db
from PIL import Image
<SNIP>
class MainMap(db.Model):
defaultmap = db.BlobProperty(default=None)
<SNIP>
class Generator(webapp2.RequestHandler):
def post(self):
self.response.headers['Content-Type'] = 'image/jpeg'
test = Image.new("RGBA",(y*2, x*2))
<SNIP>
self.response.out.write(test)
dMap=MainMap()
dMap.defaultmap = db.Blob(str(test))
dMap.put()
<SNIP>
result = db.GqlQuery("SELECT * FROM MainMap LIMIT 1").fetch(1)
if result:
print"item found<br>"
if result[0].defaultmap:
print"defaultmap found<br>"
self.response.out.write(result[0].defaultmap)
else:
print"nothing found<br>"
<SNIP>
it prints the "item found" and the "defaultmap found" but doe not
display the picture
test = Image.new("RGBA",(y*2, x*2)) should generate a black
picture because its default color is black.
when i check the datastore viewer on my local machine is see that
there are values stored
Key Write Ops ID Key Name defaultmap
ag5kZXZ-... 2 6 None <binary>
but i cannot see the contents of the blobproperty defaultmap.
Thanks in advance
Bert
--
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.