簡體   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