Ajuda com UML + ArchgenXML

3 messages Options
Embed this post
Permalink
Marcello Bontempo Salgueiro

Ajuda com UML + ArchgenXML

Reply Threaded More More options
Print post
Permalink
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

Re: Ajuda com UML + ArchgenXML

Reply Threaded More More options
Print post
Permalink
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.

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

        the scaled versions can then be accessed as
        object/<imagename>_<scalename>

        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.

        example:

        ImageField('image',
            original_size=(600,600),
            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
        object/image

        and the sizes as

        object/image_mini
        object/image_normal
        object/image_big
        object/image_maxi

        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
which
        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
        data.

        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 ;)

Abraços.

2009/7/11 Marcello Bontempo Salgueiro <[hidden email]>

>
>
> 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
Liberiun
COO
[hidden email]
+55 61 9123-7847
+55 61 3468-2662
Marcello Bontempo Salgueiro

Re: Ajuda com UML + ArchgenXML

Reply Threaded More More options
Print post
Permalink
Opa, eu sei eu tentei isso, vo fazer um na unha e ver o que
ocorre... qualquer coisa volto aqui! =)

[]s

Marcello.
 

> 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.
>
>
>         Format:
>         sizes={'mini': (50,50),
>                'normal' : (100,100), ... }
>         syntax: {'name': (width,height), ... }
>
>
>         the scaled versions can then be accessed as
>         object/<imagename>_<scalename>
>
>
>         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.
>
>
>         example:
>
>
>         ImageField('image',
>             original_size=(600,600),
>             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
>         object/image
>
>
>         and the sizes as
>
>
>         object/image_mini
>         object/image_normal
>         object/image_big
>         object/image_maxi
>
>
>         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 which
>         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
>         data.
>
>
>         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 ;)
>
>
> Abraços.
>
> 2009/7/11 Marcello Bontempo Salgueiro <[hidden email]>
>        
>        
>         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
> Liberiun
> COO
> [hidden email]
> +55 61 9123-7847
> +55 61 3468-2662
>
>