[opencms-dev] Use of VfsImageWidget

Sandrine Prousteau s.prousteau at eurelis.com
Fri Sep 28 15:22:32 CEST 2012


Hi all!

I'm trying to use VfsImageWidget in XSD.
I'd like to choose the image file, and a description. I'd like to force 'q:100,c:transparent'.

My image is image.size property = w:80,h:103.

I have set this in xsd:
<xsd:element name="Image" type="OpenCmsVfsImage" minOccurs="1" maxOccurs="1"/>      
...
<layout element="Image" widget="VfsImageWidget" configuration="{usedescription: true,scaleparams: 'q:100,c:transparent'}"/>

This leads to 
<Image>
        <link type="WEAK">
          <target><![CDATA[/sites/default/.content/media/images-logos/footer_logo.jpg]]></target>
          <uuid>133c95ca-094f-11e2-9ebd-89e1e28144a4</uuid>
          <query><![CDATA[__scale=h:193,w:150format=imageleft&description=dsfgvqsdv]]></query>
        </link>
        <description><![CDATA[dsfgvqsdv]]></description>
        <scale><![CDATA[h:193,w:150format=imageleft]]></scale>
</Image>

My code leads to:
${xmlSiteConfig.value['Image']} = /.content/media/images-logos/footer_logo.jpg?__scale=h:193,w:150format=imageleft&description=dsfgvqsdv 
${xmlSiteConfig.value['Image'].xmlText['description']} = dsfgvqsdv => alt
<cms:img src="${Image}" alt="${alt}" /> => <img src="/opencms/opencms/.content/media/images-logos/footer_logo.jpg?__scale=w:80,h:103" width="80" height="103" alt="dsfgvqsdv" />

Where is 'q:100,c:transparent' ? Why do I have a random scale & format "scale=h:193,w:150format=imageleft" ? How can I add manually "q:100,c:transparent" or other scales if the format and description are addes without any "&" or ","?
I usually choose the scale format directly in my JSP, depending on the container they are in.


Sandrine.




More information about the opencms-dev mailing list