首页 文章

在TYPO3 8的TypoScript中使用带有后退的裁剪图像

提问于
浏览
0

此TS代码始终生成600x400px图像:

10 = FILES
  10 {
      required = 1
      references {
        table = tt_content
        fieldName = image
      }
      renderObj = IMAGE
      renderObj {
        wrap = <div class="teaser-image">|</div>
        file.import.data = file:current:originalUid // file:current:uid
        file.crop.data = file:current:crop
        file.width=600c
        file.height=400c
      }
  }

如果我删除

file.width=600c
      file.height=400c

然后将使用裁剪向导中的裁剪图像 .

但我需要两者(它是现有站点的升级):如果可用,则使用裁剪的图像,但如果不可用,则使用给定的高度和宽度 .

如果给定,我如何使用“file:current:crop”部分覆盖宽度和高度?或者我如何设置后备?就像是...

file.crop.data = file:current:crop // fallback...

1 回答

  • 0

    我已经在renderObj中移动到FLUIDTEMPLATE:

    renderObj = FLUIDTEMPLATE
    renderObj {
      file = path/to/templates/content/teaser.html
      dataProcessing {
        10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
        10 {
          references.fieldName = image
          references.table = tt_content
          as = teaserimages
        }
      }
    }
    

    (FilesProcessor是必需的)

    然后在模板中

    <img src="<f:uri.image image="{teaserimages.0}" width="600c" height="400c" />
    

    表现如预期

相关问题