Fala Marcelo,
no arquivo Archetypes/Field.py você encontra o seguinte:

class ImageField(FileField):
    """ implements an image attribute. it stores
        it's data in an image sub-object

        sizes is an dictionary containing the sizes to
        scale the image to. PIL is required for that.

        sizes={'mini': (50,50),
               'normal' : (100,100), ... }
        syntax: {'name': (width,height), ... }

        the scaled versions can then be accessed as

        e.g. object/image_mini

        where <imagename> is the fieldname and <scalename>
        is the name from the dictionary

        original_size -- this parameter gives the size in (w,h)
        to which the original image will be scaled. If it's None,
        then no scaling will take place.
        This is important if you don't want to store megabytes of
        imagedata if you only need a max. of 100x100 ;-)

        max_size -- similar to max_size but if it's given then the image
                    is checked to be no bigger than any of the given values
                    of width or height.


            sizes={ 'mini' : (80,80),
                    'normal' : (200,200),
                    'big' : (300,300),
                    'maxi' : (500,500)})

        will create an attribute called "image"
        with the sizes mini, normal, big, maxi as given
        and a original sized image of max 600x600.
        This will be accessible as

        and the sizes as


        the official API to get tag (in a pagetemplate) is
        obj.getField('image').tag(obj, scale='mini')

        sizes may be the name of a method in the instance or a callable
        returns a dict.

        Don't remove scales once they exist! Instead of removing a scale
        from the list of sizes you should set the size to (0,0). Thus
        removeScales method is able to find the scales to delete the

        Scaling will only be available if PIL is installed!

        If 'DELETE_IMAGE' will be given as value, then all the images
        will be deleted (None is understood as no-op)

Ou seja, se seu campo se chama image e sua escala banner, basta chamar
contexto_objeto/image_banner e você tem a imagem redimensionada.

A única exigência aqui é a PIL, naturalmente.

Revisa suas definições e se der problema, mande detalhes ;)


2009/7/11 Marcello Bontempo Salgueiro <mbsalgue...@linuxmail.org>

> Salve a todos!
> Galera estou com uma pequena duvida, fiz um produdo de portifolio que
> tem duas classes, uma chamada Portifolio e outra Imagem e na classe
> imagem eu tenho um atributo do tipo image e coloquei um valuetag sizes
> com o valor {'ver':(500,400),'thumb':(58,58)} só que
> montei minha pagetemplate assim:
> $objeto/getURL/Imagem_ver
> ele não redimensiona a imagem para 500,400 alguem pode da uma forca!?
> []s
> Marcello.


Rodrigo Castardo
+55 61 9123-7847
+55 61 3468-2662

Responder a