简体   繁体   中英

TYPO3 (Fluid): Generate FAL-SVG-Image as inline code

Is there a fluid pendant to the new TS option Feature: #82091 - Allow inline rendering in SVG content object or a workaround? The only solution i see(atm) is to write my own viewhelper or i am missed something?

You can define a typoscript object in your root template:

lib.inlineSvg = SVG
lib.inlineSvg {
  renderMode = inline
  src.field = src
}

(see SVG cObject ). Then in your fluid you can do this:

<f:cObject typoscriptObjectPath="lib.inlineSvg" data="{src: 'path/to/the/file.svg'}" />

Of course this limits you to cases in which you have the actual path to the image. You cannot (directly) reference a FAL object. You can, however, just get the files public url:

<f:cObject typoscriptObjectPath="lib.inlineSvg" data="{src: filereference.publicUrl}" />

or

<f:cObject typoscriptObjectPath="lib.inlineSvg" data="{src: filereference.originalResource.publicUrl}" />

depending on whether you are in Extbase cotext or not (see the documentation ). You can also pass all other options the cObject takes in the data argument of the f:cObject ViewHelper (eg width).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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