# Bild URL aus Datenbank

**URL:** <https://forum.shopware.com/t/bild-url-aus-datenbank/60202>\
**Category:** Programmierung\
**Created:** [28. Juni 2019 um 09:25 UTC](https://forum.shopware.com/t/bild-url-aus-datenbank/60202 "2019-06-28T09:25:02Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)\
**Post date:** [28. September 2021 um 10:54 UTC](https://forum.shopware.com/t/bild-url-aus-datenbank/60202/13 "2021-09-28T10:54:48Z")

</div>

@FragenAnsForum @Klimax  
Bei meiner SQL ist noch ein „Fehler“. Wenn in der MD5 String die URL „/ad/“ wird, dann schreibt die Shopware um in „/g0/“, hier muss also noch ein Zusatz eingefügt werden.

```auto
CONCAT('https://example.com/media/image/',
            IF(SUBSTRING(MD5(CONCAT('media/image/thumbnail/',sai.img,'_600x600.jpg')),1,2) = 'ad','g0',SUBSTRING(MD5(CONCAT('media/image/thumbnail/',sai.img,'_600x600.jpg')),1,2)),
            '/',
            IF(SUBSTRING(MD5(CONCAT('media/image/thumbnail/',sai.img,'_600x600.jpg')),3,2) = 'ad','g0',SUBSTRING(MD5(CONCAT('media/image/thumbnail/',sai.img,'_600x600.jpg')),3,2)),
            '/',
            IF(SUBSTRING(MD5(CONCAT('media/image/thumbnail/',sai.img,'_600x600.jpg')),5,2) = 'ad','g0',SUBSTRING(MD5(CONCAT('media/image/thumbnail/',sai.img,'_600x600.jpg')),5,2)),
            '/',
            sai.img,'_600x600.jpg') AS Bilderlink

```

---

_[View the full topic](https://forum.shopware.com/t/bild-url-aus-datenbank/60202)._
