使用拼写脚本自动填充带有图像文件名的“alt”文本


Auto-fill “alt”-text with imagefile name by using typoscript?

我想使用排版为TYPO3后端中包含的所有图像添加替代文本。

<img title="ABC" alt="....." src="fileadmin/uploads/abc/nature.jpg">

如果有人对此有答案,请分享。

您可以使用模板设置文件中的以下排版代码自动为由 fal 或 rte 上传的所有图像添加替代文本。

temp.altText >
temp.altText < tt_content.image.20.1.altText
tt_content.image.20.1.altText >
tt_content.image.20.1.altText.cObject = COA
tt_content.image.20.1.altText.cObject {
    10 < temp.altText
    20 = TEXT
    20 {
        noTrimWrap = | | |
        data = file:current:name
    }
}
if you want to add page title in alt text of images then use below code
temp.altText >
temp.altText < tt_content.image.20.1.altText
tt_content.image.20.1.altText >
tt_content.image.20.1.altText.cObject = COA
tt_content.image.20.1.altText.cObject {
    10 < temp.altText
    20 = TEXT
    20 {
        noTrimWrap = | | |
        data = page:title
    }
}