If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!


  • 0
    bo  11 years ago

    i have been trying this with the following and i just cant get it to work. i am not sure what i am doing wrong.

    
    
    1. auth.settings.extra_fields['auth_user']= [
    2. Field('company_name'),
    3. Field('street'),
    4. Field('city'),
    5. Field('country'),
    6. Field('zip'),
    7. Field('phone'),
    8. Field('bio', 'text'),
    9. Field('avatar', 'upload', autodelete=True),
    10. Field('thumb', 'upload',writable=False,readable=False, autodelete=True)]
    11.  
    12. from smarthumb import SMARTHUMB
    13.  
    14.  
    15. box = (200, 200)
    16. db.auth_user.thumb.compute = lambda row: SMARTHUMB(row.avatar, box)

     

     

     

Commented on:

In this recipe you will see how to create a custom computation to create a thumbnail to fit centered in a specific box

Hosting graciously provided by:
Python Anywhere