How to display multiple images?
- by misterwebz
I'm trying to get multiple image paths from my database in order to display them, but it currently doesn't work.
Here's what i'm using:
def get_image(self, userid, id):
image = meta.Session.query(Image).filter_by(userid=userid)
permanent_file = open(image[id].image_path, 'rb')
if not os.path.exists(image.image_path):
return 'No such file'
data = permanent_file.read()
permanent_file.close()
response.content_type = guess_type(image.image_path)[0] or 'text/plain'
return data
I'm getting an error regarding this part:
image[id].image_path
What i want is for Pylons to display several jpg files on 1 page. Any idea how i could achieve this?