Reputation: 929
In my Database is the TYPO3 Media-Image-File: header_image = 1
Table: tx_test
Field: header_image
How can i output the image link? I think i need the IMG_RESOURCE and the RECORDS ?
But i dont now it works. My Test:
10 = FILES
10 {
references {
table = tx_test
#uid.data = uid
fieldName = header_image
}
renderObj = RECORDS
renderObj {
10 = IMG_RESOURCE
10 {
file {
treatIdAsReference = 1
import.data = file:current:publicUrl
}
}
}
}
works perfect!
#Title
testTitle = COA
testTitle {
# Titel
10 = RECORDS
10 {
source = 1
dontCheckPid = 1
tables = tx_test
conf {
tx_test = TEXT
tx_test {
field = title
crop = 80 | | 1
stripHtml = 1
htmlSpecialChars = 1
}
}
}
stdWrap.noTrimWrap = |<title>|</title>|
stdWrap.insertData = 1
}
thanks!
Upvotes: 0
Views: 1343
Reputation: 6084
Having read the discussion in the comments of another answer about the uid in the FILES
element, I tried some possibilities and this one works, if the TypoScript is embedded in that one for a whole record, which is retrieved by the TypoScript Elements CONTENT
or RECORDS
. It gets the uid from the content element (here: tt_content) where its saved.
10 = FILES
10 {
references {
table = tt_content
uid.field = uid
fieldName = image
}
renderObj = TEXT
renderObj {
data = file:current:publicUrl
}
}
So the whole TypoScript could look like this:
myContent = CONTENT
myContent {
table = tt_content
select {
where = AND {#CType}="tx_mysitepackage_pi1"
orderBy = sorting desc
}
renderObj = COA
renderObj {
10 = FILES
10 {
references {
table = tt_content
uid.field = uid
fieldName = image
}
renderObj = TEXT
renderObj {
data = file:current:publicUrl
}
}
20 = TEXT
20.stdWrap {
field = header
noTrimWrap = |<h1> | </h1>|
}
}
}
Upvotes: 0
Reputation: 929
here the Solution:
thanks to Paul Beck
image output with image-crop:
10 = FILES
10 {
references {
table = tx_ext_name
uid.data = GP:tx_ext_action|tx_ext_controller
fieldName = header_image
}
renderObj = IMG_RESOURCE
renderObj {
file {
treatIdAsReference = 1
import.data = file:current:uid
width = 1200c
height = 630c
}
}
}
or for the normal image-url:
10 = FILES
10 {
references {
table = tx_ext_name
uid.data = GP:tx_ext_action|tx_ext_controller
fieldName = header_image
}
renderObj = TEXT
renderObj {
data = file:current:publicUrl
}
}
Upvotes: 0
Reputation: 2683
If you really just want the URI to the Image, this should do the job.
10 = FILES
10 {
references {
table = tx_test
# YOU NEED AN UID HERE!
#uid.data = uid
fieldName = header_image
}
renderObj = TEXT
renderObj {
data = file:current:publicUrl
}
}
Upvotes: 1