[TYPO3] FCE image element with variable dimensions

Christopher Torgalson bedlamhotel at gmail.com
Sat Mar 15 10:23:55 CET 2008


Hi Nagita,

On Sat, Mar 15, 2008 at 9:21 AM, Nagita Karunaratne <Nagita.k at gmail.com> wrote:
> I want to create an Templavoila FCE with Image elements that have a
>  variable width and height taken from a variable set in the template.
>
>  Is this possible?
>
>  eg. when you edit the XML...
>
>                                                                 <TypoScript>
>         10 = IMAGE
>         10.file = GIFBUILDER
>         10.file {
>                 XY = 172,115  <-- change this to a variable
>                 10 = IMAGE
>                 10.file.import = uploads/tx_templavoila/
>                 10.file.import.current = 1
>                 10.file.import.listNum = 0
>                 10.file.maxW = 172  <-- change this to a variable
>                 10.file.minW = 172  <-- change this to a variable
>                 10.file.maxH = 115  <-- change this to a variable
>                 10.file.minH = 115  <-- change this to a variable
>         }
>  </TypoScript>
>
>  Is this possible?


Almost. If you look in the TSref at the IMAGE cObject's 'file'
property, you'll see its datatype is "imgResource"; if you then check
the imgResource page [1], you'll find that both maxW and maxH have
stdWrap properties, but that minW and minH do not.

This means that in the case of maxH and maxW, you'll be able to use
stdWrap to refer to another field in the FCE, but that you will *not*
be able to for minH and minW. To set it up, you just need to set up
some new un-mapped fields in the FCE, and change the TS to look
something like this:


10.file.maxW.field = max_width_field_name
10.file.maxH.field = max_height_field_name


Incidentally, some months ago, I think there was a discussion on the
dev list about adding stdWrap to minH and minW. Judging from the
TSref, it hasn't happened yet, but if you get the maxW and maxH
working, it would be worth trying to see if the 'mins' now have
undocumented stdWrap properties...

-- 
Christopher Torgalson
http://www.typo3apprentice.com/

[1] http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/5/2/


More information about the TYPO3-english mailing list