Hello.
I've add Smartthumb computed fields in auth_user.
Smarthumb compute images:
http://www.web2pyslices.com/slice/show/1522/generate-a-thumbnail-that-fits-in-a-box
In the model:
auth.settings.extra_fields['auth_user']= [
Field('image_user', 'upload', label=T('Profile user image'), requires=[
IS_EMPTY_OR(IS_IMAGE(error_message=T('This is not an image.'))), IS_LENGTH(
maxsize=1048576)], comment=(T('Optional. Square image. A rectangular image
will be cropped.'))),
Field('newsletter', type='boolean', default=True),
Field('image_user250x250','upload', readable=False, writable=False,
autodelete=True, compute=lambda row: SMARTHUMB(row.image_user, (250, 250),
name='image_user250x250')),
Field('image_user192x192','upload', readable=False, writable=False,
autodelete=True, compute=lambda row: SMARTHUMB(row.image_user, (192, 192),
name='image_user192x192')),
Field('image_user125x125','upload', readable=False, writable=False,
autodelete=True, compute=lambda row: SMARTHUMB(row.image_user, (125, 125),
name='image_user125x125')),
Field('image_user32x32','upload', readable=False, writable=False,
autodelete=True, compute=lambda row: SMARTHUMB(row.image_user, (32, 32),
name='image_user32x32')),
Field('image_user16x16','upload', readable=False, writable=False,
autodelete=True, compute=lambda row: SMARTHUMB(row.image_user, (16, 16),
name='image_user16x16')),
]
When the user register, the image_user file is saved but the computed
fields like image_user_250x250 are not computed.
If the user go to his user profile and save it again all computed fields
are computed.
Someones knows why?
Thanks.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.