dynamically creating/setting properties, Was: setting scaled image troubles
"Diez B. Roggisch" <[email protected]>
| Newsgroups | gmane.comp.cms.zms.devel |
|---|---|
| Message-ID | <[email protected]> |
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