# Bilder über REST-API und CDN

**URL:** https://forum.shopware.com/t/bilder-uber-rest-api-und-cdn/59535
**Category:** Programmierung
**Created:** [14. Mai 2019 um 14:44 UTC](https://forum.shopware.com/t/bilder-uber-rest-api-und-cdn/59535 "2019-05-14T14:44:27Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mbdus](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/mbdus/32/12997_2.png) [@mbdus](https://forum.shopware.com/u/mbdus)
#### Post date: [14. Mai 2019 um 14:44 UTC](https://forum.shopware.com/t/bilder-uber-rest-api-und-cdn/59535/1 "2019-05-14T14:44:27Z")

</div>

Ich lege neue Artikel per REST-API an und aktualisiere diese. Das klappt soweit.

Danach habe ich in der config.php folgendes geändert:

```
'cdn' => [
       	'backend' => 'ftp',
        'adapters' => [
            'ftp' => [
                'type' => 'ftp',
                'mediaUrl' => 'https://cdn.domain.de/',
                'path' => realpath( __DIR__. '/../../../'),
                'host' => 'cdn.domain.de',
                'username' => 'username',
                'password' => 'password',
                'port' => 21,
                'root' => '/root/',
                'passive' => true,
                'ssl' => false,
                'timeout' => 30,
            ]
        ]
    ]

```

Ich konnte beobachten, dass das erste Bild noch in den temp-Ordner von [domain.de](http://domain.de) kopiert wird. Aber es kommt nicht auf [cdn.domain.de](http://cdn.domain.de) an. Lade ich das Bild über das Backend hoch, funktioniert es. Und die Bilder werden auch im Frontend angezeigt.

Die Fehlermedlung lautet:

```
Fatal error: Uncaught League\Flysystem\FileNotFoundException: File not found at path: media/image/7d/7c/1d/abdo-trainer-twist-05TI2WtxCZ00KZZ_140x140.jpg in /var/www/vhosts/domain.de/vendor/league/flysystem/src/Filesystem.php:381 Stack trace: #0 /var/www/vhosts/domain.de/vendor/league/flysystem/src/Filesystem.php(191): League\Flysystem\Filesystem->assertPresent('media/image/7d/...') #1 /var/www/vhosts/domain.de/engine/Shopware/Bundle/MediaBundle/MediaService.php(104): League\Flysystem\Filesystem->readStream('media/image/7d/...') #2 /var/www/vhosts/domain.de/engine/Shopware/Components/Thumbnail/Generator/Basic.php(323): Shopware\Bundle\MediaBundle\MediaService->readStream('media/image/7d/...') #3 /var/www/vhosts/domain.de/engine/Shopware/Components/Thumbnail/Generator/Basic.php(301): Shopware\Components\Thumbnail\Generator\Basic->downloadIma in /var/www/vhosts/domain.de/vendor/league/flysystem/src/Filesystem.php on line 381

```

Das Bild soll ja auch nicht unter [domain.de](http://domain.de) aufrufbar sein, sondern unter [cdn.domain.de](http://cdn.domain.de). Kann es sein, dass man ein Bild nicht über die REST-API und CDN hochladen kann? Dann würde ich mir eine eigene Funktion bauen.
