How to display multiple images?

Posted by misterwebz on Stack Overflow See other posts from Stack Overflow or by misterwebz
Published on 2010-05-15T22:02:58Z Indexed on 2010/05/15 22:10 UTC
Read the original article Hit count: 230

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about pylons

Related posts about sqlalchemy