[Product-Developers] Re: [AT/ImageField] Rescaling images with a fixed width

Raphael Ritz r.ritz at biologie.hu-berlin.de
Fri Jan 23 09:59:15 UTC 2009

Andreas Jung wrote:
> Hash: SHA1
> Hi there,

Hi Andreas,

> I have the following usecase:
>  - an ATImage derived image class contains a field "imageClass"
>  - for a certain value of 'imageClass' the uploaded original image
>    must be scaled up or down to _fixed width of 500px_ (independent
>    of the image ratio) for all cases.
> I came to the point where I am able to set the 'max_size' and
> 'original_size' parameter for individual instances of my image class
> implementation. Scaling an image down to 500px width works so far
> for image where width>height but not if height>width. Also upscaling
> does not seem to be support by rescaleOriginal() implementation
> of ImageField. Any hint if this problem can be solved with a custom
> parameters for 'max_size' and/or 'original_size'

Not sure this helps but the ImageField's property 'sizes' can
also be the name of a callable (on the instance I think).
So maybe it's possible to have such a method create the
appropriate scale to be included in the dict returned.
Then 'createScales' should take care of generating the
appropriately scaled version under whatever key you define.

Keep us updated on your progress.


> Version: GnuPG v1.4.9 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> XaoAoNwFqdgLp/QAO3kKG1UvNVtC2lcf
> =DsFt
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> http://lists.plone.org/mailman/listinfo/product-developers

More information about the Product-Developers mailing list