Ibexa DXP Discussions

Community discussion forum for developers working with Ibexa DXP

Render image field in current language


I have a problem to get translated images. This is my code :slight_smile:

{% if not ez_is_field_empty( content, "image" ) %}
<div class="entry_image">
{% set image = content.getField( 'image' ) %}
{% set imageAlias = ez_image_alias( image, content.versionInfo,'fulllarge' ) %}
<img src="{{ asset( imageAlias.uri ) }}" width="100%" height="{{imageAlias.height }}" alt="{{ image.value.alternativeText }}" title="{{ ez_field_value(content, "titre" ) }}" />
{% endif %}

For a reason i don’t know he just take the image of the main language, and not the translated image. How can i force it ?


Use Site API and don’t worry, it does it transparently :wink: https://github.com/netgen/ezplatform-site-api/blob/master/EXAMPLES.md#12-some-comparison-of-usage-from-twig

I forgot to say. I’m working on a weird version (new client) : 5.90.0alpha1
Do you think it’s possible to use what you said ?

That is a relatively old version of the ezpublish-legacy. you need to check what it she version of the ezpublish-kernel

Can this resolve my problen regarding objectrelation (image)?

Regards, Atle