Print image URL with image style I would like to print an image URL with an image-style.
This doesn't work, since I don't have a ".value"-value for the image: How to find image style URL from within twig template?

Is there anything different on field-templates?

My code in field--field-images.html:

{% for item in items %}
    &lt;img src="{{ item.content['#url'].uri }}"&gt;
{% endfor %}


This doesn't work (results in no filename since .value isn't available:

&lt;img src="{{ item.content['#url'].uri.value  | image_style('image_style') }}"&gt;


This crashes the page:

&lt;img src="{{ item.content['#url'].uri | image_style('image_style') }}"&gt;


Thanks!
Change the display mode of your field with the image style you want. And it's ok

But If you want do this with a custom module, you can do this:


$imageFile = Media::load($media_mid);
$style = \Drupal::entityTypeManager()->getStorage('image_style')->load('thumbnail');
$imageThumbnailUri = $style->buildUrl($imageFile->get('thumbnail')->entity->getFileUri());