I try to add a language menu with typoscript, but the files I want to add as images ar not working.
my typoscript looks like this:
## Localization menu:
temp.langMenu = HMENU
temp.langMenu.special = language
temp.langMenu.special.value = 0,2
temp.langMenu.1 = GMENU
temp.langMenu.1.NO {
XY = [5.w]+4, [5.h]+4
backColor = white
5 = IMAGE
5.file = fileadmin/bilder/DE-flag-32.png || fileadmin/bilder/US-flag-32.png
5.offset = 2,2
}
temp.langMenu.1.ACT < lib.langMenu.1.NO
temp.langMenu.1.ACT = 1
temp.langMenu.1.ACT.backColor = black
temp.langMenu.1.USERDEF1 < lib.langMenu.1.NO
temp.langMenu.1.USERDEF1 = 1
temp.langMenu.1.USERDEF1.5.file = fileadmin/bilder/DE-flag-32.png || fileadmin/bilder/US-flag-32.png
temp.langMenu.1.USERDEF1.noLink = 1
Cache is clean ...
result is this:
links are working but no image. in Site-source code the image got this path:
<img src="/typo3temp/menu/4baf3d2e70.gif" width="36" height="36" alt="Home">
Whats my Mistake in this case
I usually have a similar approach:
temp.language = HMENU
temp.language {
special = language
// 0 = Deutsch, 1 = Englisch
special.value = 0,1
wrap = <ul class="langmenu">|</ul>
1 = GMENU
1 {
NO = 1
NO {
format = png
// size of flag grafics
XY = 38,17
transparentColor = #00FFFF
backColor = #00FFFF
10 = IMAGE
10.file = fileadmin/flags/de.png || fileadmin/flags/uk.png
10.offset = 10,0
10.file.width = 28
10.file.height = 17
wrap = <li>|</li>
}
ACT < .NO
ACT {
20 = IMAGE
20.file = fileadmin/flags/arrow.gif
20.format = png
20.offset = 0,3
noLink = 1
wrap = <li class="act">|</li>
}
// if translation is not available:
USERDEF1 < .NO
USERDEF1 {
// the grayscale effectdoes not work with some IM versions
30 = EFFECT
30.value = gray | gray=1 | grey | grey=1
// the same flags like above, bleached
40 = EFFECT
40.value = gamma=5
// naturally this should not be linked either
noLink = 1
}
}
}
differences which might be important:
I use constant values for the generated images and no blank after the comma
I give explicit sizes for the used images
I use color values instead of color names
I use transparent color
Image generation on the server (the install tool checks) is working in general? Pay special attention to the GDlib tests
install of imagemagick does the job
Related
I want to use the GIFBUILDER to make an image with an overlay. The image should therefore be delivered via FLUID.
This is what I have so far:
FLUID
<f:for each="{product.images}" as="image">
<f:cObject typoscriptObjectPath="lib.overlay" data="{image: image.uid}" />
</f:for>
TypoScript
lib.overlay = IMAGE
lib.overlay {
file = GIFBUILDER
file {
XY = 300,500
format = jpg
quality = 80
10 = IMAGE
10 {
file.import = {field:image}
file.import.insertData = 1
file.import.treatReferenceAsId = 1
}
20 = TEXT
20 {
text = Copyright
fontColor= #dddddd
fontSize = 30
offset = 100,100
align = left
antiAlias = 1
}
}
}
At the moment, I only get a white Background with the label Copyright on it. However if I do somethinge like
10 = IMAGE
10.file = fileadmin/path/to/file
all works just fine.
So my question is: How do I pass the Image from FLUID correctly to TypoScript?
And as addition to this, how do I pass a value from the Contentelement via FLUID to make the overlay text dynamic too?
Best regards and Thanks in advance
UPDATE:
output of {image} (one image):
Replace
10 = IMAGE
10 {
file.import = {field:image}
file.import.insertData = 1
file.import.treatReferenceAsId = 1
}
with
10 = IMAGE
10 {
file.import.field = image
file.treatIdAsReference = 1
}
treatReferenceAsId should be treatIdAsReference. It's also a property of file, not of file.import. I'm not sure why file.import = {field:image} and insertData = 1 doesn't work, but file.import.field = image does. It's cleaner anyway, which is why I tried it.
You might also want to add a width and height or maxW and maxH to the image, unless you're 100% sure they're always 300x500 pixels.
I am getting the text from the abstract field and splitting it by new line.
What I want is to wrap the first line in an H5 tag and all lines after in P tags.
This is what I have tried:
tt_content.menu.20.102 = HMENU
tt_content.menu.20.102 {
1 = TMENU
1 {
NO = 1
NO {
doNotLinkIt = 1
stdWrap.cObject = COA
stdWrap.cObject {
50 = TEXT
50.stdWrap {
field = abstract
split {
token.char = 10
cObjNum = 1 || 2
1.current = 1
1.wrap = <h5>|</h5>
2.current = 1
2.wrap = <p>|</p>
}
}
}
}
}
}
But it wraps all the lines in H5... How do I make this work?
I found a bug report that mentions this issue here: https://forge.typo3.org/issues/59533
It seems the best workaround that I can see is to instead use listNum
This has the obvious drawback of only working with a limited number of paragraphs but at least it sort of works.
10 = TEXT
10.field = abstract
10.wrap = <h5>|</h5>
10.listNum = 0
10.listNum.splitChar = 10
20 < .10
20.wrap = <p>|</p>
20.listNum = 1
30 < .20
30.listNum = 2
Just a combination of both, the original code and the listNum workaround should do the job. Still have to find a way to get the rest of the first "split" into the second one. So consider this answer to be WIP please. We are still discussing it on our Coders.Care Twitch channel in the TYPO3 service station.
10 = TEXT
10.field = abstract
10.wrap = <h5>|</h5>
10.listNum = 0
10.listNum.splitChar = 10
20 < .10
20.listNum = 1
20.split {
token.char = 10
cObjNum = 1
1.current = 1
1.wrap = <p>|</p>
}
i want to write a Copyright-Entry on images which are created with GifBuilder:
lib.imageWithWatermark = IMG_RESOURCE
lib.imageWithWatermark {
file = GIFBUILDER
file {
XY = [10.w],[10.h]
format = jpg
quality = 100
10 = IMAGE
10.file {
import.data = current
treatIdAsReference = 1
maxW = 1600
maxH = 1000
}
20 = IMAGE
20.offset = [10.w]-[20.w]-20,[10.h]-[20.h]-20
20.file = fileadmin/theme/lib/v1/img/watermark.png
30 = TEXT
30 {
text = Copyright
fontColor= #dddddd
fontSize = 12
offset = 20,[10.h]-20
fontFile = fileadmin/theme/lib/v1/fonts/verdana.ttf
align = left
antiAlias = 1
}
}
}
in 30.text I need the entry from the meta data of the image (image.resources.properties.creator in fluid) but i dont have any clue how to achieve this in typoscript ...
Any help?
Thanks!
OK, after a few hours I found the solution. Perhaps it is useful for some other people ... :-)
lib.imageWithWatermark = COA
lib.imageWithWatermark {
# get meta data here - in GIFBUILDER it seems not possible
10 = FILES
10 {
# current derives from a fluid template: it contains the uid of a sys_file_reference entry (!) - not sys_file
# so we cannot use files but must use references which links sys_file_reference with sys_file.
references.data = current
renderObj = COA
renderObj {
# we have to use register
10 = LOAD_REGISTER
10 {
param = TEXT
# Attention: current is now the current file in renderObj - it contains now the uid of the sys_file entry.
param.data = file:current:creator
}
}
}
# OK the more tradional rest
20 = IMG_RESOURCE
20 {
file = GIFBUILDER
file {
XY = [10.w],[10.h]
format = jpg
quality = 100
10 = IMAGE
10.file {
import.data = current
treatIdAsReference = 1
maxW = 1600
maxH = 1000
}
20 = IMAGE
20.offset = [10.w]-[20.w]-20,[10.h]-[20.h]-20
20.file = fileadmin/theme/lib/v1/img/watermark.png
30 = TEXT
30 {
# get text from register.
text.data = register:param
fontColor= #dddddd
fontSize = 12
offset = 20,[10.h]-20
fontFile = fileadmin/theme/lib/v1/fonts/verdana.ttf
align = left
antiAlias = 1
}
}
}
}
I've got a TYPO3 page which is only in german. Now I want to set up the page in english as well. How can I realise this? I've read about webpage language and so on but, can't find a whole tutorial.
I'm using TYPO3 6.2.9
Thanks a lot
Update
## Localization menu:
lib.langMenu = HMENU
lib.langMenu {
special = language
special.value = 0,1,2
special.normalWhenNoLanguage = 0
1 = GMENU
1.NO {
XY = [5.w]+4, [5.h]+4
backColor = white
5 = IMAGE
5.file = EXT:cms/tslib/media/flags/flag_uk.gif || EXT:cms/tslib/media/flags/flag_de.gif
5.offset = 2,2
}
1.ACT < lib.langMenu.1.NO
1.ACT=1
1.ACT.backColor = black
1.USERDEF1 < lib.langMenu.1.NO
1.USERDEF1=1
1.USERDEF1.5.file = EXT:cms/tslib/media/flags/flag_uk.gif || EXT:cms/tslib/media/flags/flag_de.gif
1.USERDEF1.noLink = 0
1.USERDEF2 < lib.langMenu.1.USERDEF1
1.USERDEF2.backColor = green
}
Well,
in TYPO3 it is really easy to set up an other Language
All you need to do ist:
Create on your rootpage (the world) a new lanuguage
Then add in your Setup on the rootpage the following (for example french)
[globalVar = GP:L = 1]
config.sys_language_uid = 1
config.language = fr
config.locale_all = fr_FR
[global]
Then translate your first page.
You can access the page with this link.
Hope it helps.
I have an HMENU in Typo3, in the Pageproperties i have stored an image. How can i show the Image from the Pageproperties in ne Menu? I have no Idea, why the image is not displayed.
Typo3 6.2
lib.produkt_start = HMENU
lib.produkt_start {
special = directory
special.value = 3
wrap = |
1 = TMENU
1 {
expAll = 1
NO = 1
NO {
allWrap = <div class="patterns col4" id="page_{field:uid}">|</div>
allWrap.insertData = 1
ATagParams = id="uid{field:uid}"
ATagParams.insertData = 1
stdWrap.cObject >
stdWrap.cObject = COA
stdWrap.wrap = |
stdWrap.cObject {
10 = TEXT
10.field = title
10.wrap = <br /><h2>|</h2>
10.insertData = 1
20 = TEXT
20.wrap = <p><span>|</span></p>
20.field = subtitle
30 = IMAGE
30.file.import.data = levelmedia-1, slide
30.treatIdAsReference = 1
30.import.listNum = 0
30.wrap = <h5>|</h5>
}
}
ACT = 1
ACT < .NO
}
}
I tested your problem with TYPO3 6.1.7
First of all you have to correct you code a little:
[...]
stdWrap.cObject {
10 = TEXT
10.field = title
10.wrap = <br /><h2>|</h2>
10.insertData = 1
20 = TEXT
20.wrap = <p><span>|</span></p>
20.field = subtitle
30 = IMAGE
30.file.import.data = levelmedia:-1, slide
30.file.treatIdAsReference = 1
30.file.import.listNum = 0
30.wrap = <h5>|</h5>
}
[...]
Now it will be "working" but only if you actually set an image in media field of the parent page, then it will be renderd in all child pages, ignoring the fact that the child pages have an own image set - I would consider this as sort of a bug of TMENU or TMENUITEM, but I haven't realy testet it fully.
You will get a problem with entity encoding of the title as well so I would try this option:
stdWrap.wrap.cObject = COA
stdWrap.wrap.cObject {
10 = TEXT
10.value = <br><h2>|</h2>
20 = TEXT
20.wrap = <p><span>|</span></p>
20.field = subtitle
30 = IMAGE
30.file.import.data = levelmedia:-1, slide
30.file.treatIdAsReference = 1
30.file.import.listNum = 0
}
Strange is that the following does not work either:
30.file.import.field = media
This makes my suspition of the wrong slide behaviour above being a bug even stronger.