On Saturday, October 15, 2016 at 3:20:41 AM UTC-4, Jaimee S wrote: > > <get_file.html> > > <img src="{{=URL('download',args=db.auth_user.picture)}}/> >
db.auth_user.picture is a Field object -- you need that actual value of the "picture" field from a particular user record. > #displays broken image > > #other failed methods > {{for b in row:}}<img...args=b.picture>{{pass}} > Hard to say what's wrong here, as we don't know what "b" is. Also, what's in the "..." may be important -- "args" should be an argument of the URL function, not an attribute of the img tag -- but we can't tell how you have used it here. > #also used for loop to print out username. That worked, but when I tried > image it displayed a link. When I added img tags before the link I got a > broken link > > <h2>{{=row.picture}}</h2> > row.picture is just the DAL-generated filename of the picture -- just inserting that in the view won't create an image tag for the picture. > <h2>{{row.picture}}</h2> > Without a preceding "=", nothing will be inserted in the view. > <h2>{{db.auth_user.picture}}</> > Again, no "=", and db.auth_user.picture is a Field object. Assuming you want to display all users: users = db(db.auth_user).select() # pass this to the view In the view: {{for user in users:}} <img src="{{=URL('default', 'download', args=user.picture)}}"> {{pass}} Before proceeding, it might help if you spend some time going through the documentation. In particular, have a look at http://web2py.com/books/default/chapter/29/03/overview#An-image-blog. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.