# Thumbnail eines custom field Bildes

**URL:** https://forum.shopware.com/t/thumbnail-eines-custom-field-bildes/103398
**Category:** Themes & Design
**Tags:** programming, themes--design
**Created:** [21. März 2024 um 14:38 UTC](https://forum.shopware.com/t/thumbnail-eines-custom-field-bildes/103398 "2024-03-21T14:38:17Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![owy](https://avatars.discourse-cdn.com/v4/letter/o/b38774/32.png) [@owy](https://forum.shopware.com/u/owy)
#### Post date: [21. März 2024 um 14:38 UTC](https://forum.shopware.com/t/thumbnail-eines-custom-field-bildes/103398/1 "2024-03-21T14:38:17Z")

</div>

Wir verwenden in einem Theme die Subkategorien mit einem Bild aus einem custom field. Der Kunde hat nun aber sehr grosse Bilder hochgeladen und im Code wird nur direkt auf die URL des Bildes zugegriffen:

```auto
                                <div class="img-wrapper">
                                    {% if SinglesubCatCf1Media|length > 0 %}

                                        {% set SinglesubCat1Url = SinglesubCatCf1Media.getUrl %}
                                        {% set SinglesubCat1filenm = SinglesubCatCf1Media.getfileName %}
                                        <img src="{{ SinglesubCat1Url }}" alt="{{ SinglesubCat1filenm }}" height="auto" width="100%" class="img-fluid">
                                    {% else %}
                                        <img src="{{ owyCatIcon }}" alt="No Image" height="auto" width="auto" class="img-fluid">
                                    {% endif %}
                                    
                                </div>

```

Nun ist es natürlich naheliegend, dafür sw\_thumbnail zu verwenden. Nur werde ich aus der Beschreibung hier nicht wirklich schlau: [Working with Media and Thumbnails | Shopware Documentation](https://developer.shopware.com/docs/guides/plugins/plugins/storefront/use-media-thumbnails.html)  
media: cover - das scheint das „Cover“ Bild bei Produkten - was verwende ich in dem Fall oben? Und ist ‚my\_thumbnails‘ frei wählbar oder ist dies die Referenz auf das Bild?

Bzw. ich stelle es mir so vor, dass ich die Bild ID übergeben kann und die Grösse und dann das Thumbnail erhalte…

Vielleicht kann mir jemand hier auf die Sprünge helfen…

VG  
Daniel

---

<div class="post-metadata">

### Author: ![area-net-gmbh](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/area-net-gmbh/32/21995_2.png) [@area-net-gmbh](https://forum.shopware.com/u/area-net-gmbh)
#### Post date: [21. März 2024 um 14:52 UTC](https://forum.shopware.com/t/thumbnail-eines-custom-field-bildes/103398/2 "2024-03-21T14:52:41Z")

</div>

Du musst das ganze Medien-Objekt übergeben:

```auto
{% sw_thumbnails 'my-thumbnails' with {
    media: SinglesubCatCf1Media
} %}

```
