Hi
I need show images from the App Engine datadase in templates .html
I have googled for hours and hours searching for a topic that can help
me and nothing, only i have found some examples about how to show
images from directory or from database using python generated html
code.
The name property is showed perfectly on my template but on the image
only show an not image icon
A bit of my actual code:
On my Model:
class Appuser(db.Model):
appuser = db.UserProperty()
name = db.StringProperty()
image = db.BlobProperty(default=None)
-------------------------------------------------------------------------------------------
my python file:
class get_image:
def get(self):
i = web.input()
appuser = db.get(db.Key(i.key))
if (appuser and appuser.original):
web.header("Content-Type","image/jpeg")
return appuser.original
else:
return web.seeother('/static/images/noimage.png')
I using '.original' value because in some moment on my search i have
wroted that this is the mode in that app engine call the blob data
type, this was an example using the webapp framework, I dont know if
this is true in Webpy
-------------------------------------------------------------------------------------------
template.html:
$def with (m)
<html>
<body>...
$for appuser in m:
<div>$appuser.name</div>
<div><img alt="" src="$appuser.image"></div>
</body>
</html>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---