繁体   English   中英

TYPO3-通过打字和数据库输出图像路径?

[英]TYPO3 - Output the image path via typoscript and database?

在我的数据库中是TYPO3媒体图像文件:header_image = 1

表:tx_test

栏位:header_image

如何输出图像链接? 我想我需要IMG_RESOURCE和RECORDS吗?

但是我现在不行。 我的测试:

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
    }

谢谢!

如果您真的只想要Image的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

使用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
                }
            }
        }

或正常的图片网址:

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
                }
        }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM