[Typo3] Help! click enlarge other images
Torsten Schrade
schrade at lineara.de
Mon Sep 12 10:45:38 CEST 2005
Henry Wilhelm schrieb:
> Hi Peter
>
> Thank you for this hint. I know about "tt_content.image" object defined in "EXT:css_styled_content/static/". But i do not know, how i can redefine it in that way, that imageLinkWrap will make a linkwrap to another image than the according image.
>
> 10 = IMAGE
> 10.file.import = uploads/tx_templavoila/
> 10.file.import.current = 1
> 10.file.import.listNum = 0
>
> ==> ok, i have got the image from DS-field "field_imagesmall"
>
> 10.imageLinkWrap
>
> ==> this is allways the same image from DS-field "field_imagesmall", but here i need the image from DS-field "field_imagebig"
>
> the output should look something like this
>
> <a href="#" onclick="openPic('http://localhost/typo3/showpic.php?file=uploads/tx_templavoila/img_big.jpg...'"><img src="uploads/tx_templavoila/img_small.jpg".../></a>
>
> I don`t think, that this is possible with TS, am i right? Or can you please give an example?
>
> thanks
>
> Henry
Hi Henry,
I've been thinking about this - the following partially solves your
question:
1. First of all let's define field_imagesmall with a TS-Object path
rather than with the TS directly in the xml:
<field_imagesmall type="array">
<tx_templavoila type="array">
<title></title>
<sample_data type="array">
<numIndex index="0"></numIndex>
</sample_data>
<eType>image</eType>
<TypoScriptObjPath>lib.imagepopup</TypoScriptObjPath>
</tx_templavoila>
Now you can conveniently adress the whole thing with lib.imagepopup from
your TS-Template.
2. In your TS-Template, insert the following:
# Image w/ popup
lib.imagepopup = IMAGE
lib.imagepopup {
file {
import = uploads/tx_templavoila/
import.current = 1
import.listNum = 0
}
imageLinkWrap = 1
imageLinkWrap {
enable = 1
typolink {
# this is one line!
parameter = /uploads/tx_templavoila/{field:field_imagebig}
350x450:resizable=0,location=1
parameter.insertData = 1
}
}
}
In templavoila, all fields of your FCEs (mapped or unmapped) are
available in the CObject-Array at parsetime so you can get the values
with stdWrap like above. Typolink has to be used to override the values
from imageLinkWrap.
As you can see the problem is not getting the field (and second image)
but opening the window with the correct dimensions. We cannot work with
JSWindow because then the width/height of the first image would be used
for the popup.
Above it's hardcoded 350x450 and I see no chance at the moment to get
the width/height from the second image dynamically, as the whole stuff
is not passed to showpic.php...
So there are two alternatives:
1. Open the big images with a fixed popup like above.
2. Make two more fields for width/height in your FCE. Then you can
insert different dimensions for each popup and get the values just like
above:
# this is one line
.parameter = /uploads/tx_templavoila/{field:field_imagebig}
{field:field_imagebigwidth}x{field:field_imagebigheight}:resizable=0,location=1
Maybe someone else has another idea how to get the dimensions of the
second image dynamically.
Cheers, Torsten
More information about the TYPO3-english
mailing list