Re: dynamically creating/setting properties, Was: setting scaled image troubles

Sebastian Tänzer <[email protected]>
Newsgroups gmane.comp.cms.zms.devel
Message-ID <[email protected]>
Hi Diez,

I don't know if we're talking about the same task but you can easiliy  
use any form field (i.e. input, select etc.) by using  
REQUEST.get('myfield') instead of getObjProperty.

Please give a better explanation of what you're trying to do.

Yours sincerely
Sebastian Tänzer

tänzermedien e.K.
concept / design / coding

c/o amcm GmbH
Kekuléstr. 39
53115 Bonn
Germany

Tel      +49-228-33646-23
Fax     +49-228-33646-13
Mobil  +49-174-333-7001

E-Mail [email protected]
WWW  http://www.taenzer.me

Am 15.02.2009 um 20:14 schrieb Diez B. Roggisch:

> Hi,
>
> >
> > As far as I understand you're trying to create the thumbnail  
> within a
> > python script. You don't have to.
> > Inside your content object create a method (method, not DTML- 
> Method!)
> > "onChangeObjEvt" with the following code:
> >
> > <dtml-call "setObjProperty('img',
> > createThumbnail
> > (img
> > =
> > getObjProperty
> > ('imghighres
> > ',REQUEST
> > ),maxdim
> > =
> > getObjProperty
> > ('thumbwidth
> > ',REQUEST),qual=getObjProperty('thumbquality',REQUEST)),lang)">
> >
> > This one replaces the "img" field (type: image) with a thumbnail  
> from
> > the image from the imghighres and takes the properties for maxdim  
> and
> > quality (jpeg quality) from the string fields thumbwidth and
> > thumbquality.
> > If you want to just resize the existing image inside field "img"
> > replace imghighres with img.
> >
> > Without using different fields:
> >
> > <dtml-call "setObjProperty('img',
> > createThumbnail
> > (img=getObjProperty('imghighres',REQUEST),maxdim=20,qual=95),lang)">
>
> Thanks, this works - but not quite the way I wanted it to be :)
>
> The problem is that the setObjProperty call only accepts names that  
> are
> already defined in the system.
>
> So, if I wanted the image to be scaled based on some select-box in the
> editing interface, I have to create an image-property for each  
> offered size.
>
> This works, and if there is no other solution, I'll stick with it.
>
> However, I wonder if there is a way of adding a hitherto unknown  
> property?
>
> Thanks,
>
> Diez
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.