TYPO3 - 通过打字稿和数据库输出图像路径?
TYPO3 - Output the image path via typoscript and database?
我的数据库中有 TYPO3 媒体图像文件:
header_image = 1
Table: tx_test
字段:header_image
如何输出图像link?
我想我需要 IMG_RESOURCE 和记录 ?
但我现在没用。我的测试:
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
}
}
}
}
完美!
#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
}
谢谢!
如果您真的只想要图像的 URI,这应该可以完成工作。
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
}
}
这里是解决方案:
感谢 Paul Beck
带图像裁剪的图像输出:
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
}
}
}
或者普通图片-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
}
}
我的数据库中有 TYPO3 媒体图像文件: header_image = 1
Table: tx_test
字段:header_image
如何输出图像link? 我想我需要 IMG_RESOURCE 和记录 ?
但我现在没用。我的测试:
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
}
}
}
}
完美!
#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
}
谢谢!
如果您真的只想要图像的 URI,这应该可以完成工作。
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
}
}
这里是解决方案:
感谢 Paul Beck
带图像裁剪的图像输出:
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
}
}
}
或者普通图片-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
}
}