Ad

TYPO3: How To Use Flux:field.inline.fal Image As Background

- 1 answer

In a template in my extension I use the field.inline.fal viewhelper: Documentation

Now I want to use this as a background image. I tried:

// This is the input in the configuration section
<flux:field.inline.fal name="image" required="1" maxItems="1" minItems="1"/>

//This is the output
{v:content.resources.fal(field: 'image') -> v:iterator.first() -> v:variable.set(name: 'image')}
<div class="image" style="background: url({image.id});">

For some reason the frontend output is:

<div class="image" style="background: url(1:/data/images/path/image.jpg);">

but it should be

<div class="image" style="background: url(/rootfolder/data/images/path/image.jpg);">

Why doesn't it display as described in the Documentation? What did I do wrong?

Ad

Answer

Found the answer. Via <f:debug>{image} I found the variable {image.url} which gives the whole path.

Working code:

  <div class="image" style="background: url(/{image.url});">
Ad
source: stackoverflow.com
Ad