Re: preconfiguring / -parametering image cropping in special objects

"dr_frank_hoffmann" <[email protected]> Wed, 24 Aug 2011 12:42:43 -0000
Newsgroups gmane.comp.cms.zms.devel
Message-ID <[email protected]>

Hello,
you can use the trigger events
  _versionmanager.onChangeObj: onChangeObjEvt
by adding such a function to the content object defintion.
And for shrinking images you can use this functions here:
  _blobfields.thumbnailImage
Please consider that there must be a REQUEST variable
'generate_preview_%s_%s'%(hiresKey,lang)
set to 1 to trigger the default scaling.

---------
Example DTML 
for ex-post scaling 
all images of a tree 
(code is not tested!):
---------
%<- - - - - - -
<ol>
<dtml-with "content">
<dtml-var f_standard_html_request>
<dtml-let l="[this()]">
<dtml-call "l.extend(getTreeNodes(REQUEST, meta_types=['ZMSGraphic']))">
<dtml-in l>
<dtml-try>
<dtml-call "REQUEST.set('generate_preview_imghires_ger',1)">
<dtml-call "setObjStateModified(REQUEST)">
<dtml-call "onChangeObj(REQUEST,forced=1)">
<dtml-call "commitObj(REQUEST)">
<dtml-except>
<li>ERROR: <a href="<dtml-var "_['sequence-item'].absolute_url()">/manage"><dtml-var "_['sequence-item'].absolute_url()"></a></li>
</dtml-try>
</dtml-in>
</dtml-let>
</dtml-with>
</ol>
%<- - - - - - -

Maybe this small hint helps.
Regards
fh, moderator