Why are some graphics in Shopware not delivered by the CDN?
The creoline® CDN delivers images by manipulating the Shopware Media Manager. Both Shopware 5 and Shopware 6 work with dynamic generation of image URLs so that the actual image URL is generated when the page is called up.
Example Shopware 5
Images from the Media Manager are loaded in Shopware 5 e.g. via the Smarty Media plugin:
<img src="{media path=$sArticle.media[0].media.path}"
class="blog--image panel has--border is--rounded"
alt="{$alt}"
title="{$alt|truncate:160}"/>
The Shopware 5 plugin CDN for Shopware 5 adapts the URL generated from this to the CDN domain so that the image is loaded via the CDN instead of via the standard store domain.
Result without the CDN plugin:
The generated HTML document contains the following code:
<img src="https://shopware-5.creoline-demo.com/media/image/29/d4/02/hq_1280x1280.jpg"
class="blog--image panel has--border is--rounded"
alt="Alternative text"
title="Alternative text"/>
Result with the CDN plugin:
The generated HTML document contains the following code:
<img src="https://shopware-5.cstatic.io/media/image/29/d4/02/hq_1280x1280.jpg"
class="blog--image panel has--border is--rounded"
alt="Alternative text"
title="Alternative text"/>
In the second result, the original domain shopware-5.creoline-demo.com
is replaced by the CDN domain shopware-5.cstatic.io
. The request URI /media/image/29/d4/02/hq_1280x1280.jpg
remains unaffected by this.
Troubleshooting
Solution 1: Use media manager plugin
In order for the Shopware plugin to recognize the images, the image must be loaded via the Media Manager. Otherwise, the CDN plugin cannot manipulate the image URL.
Solution 2: Use a static CDN domain
If the desired image cannot be made accessible via the Media Manager, there is also the option of integrating the CDN domain independently.
See also: Customizing the image paths
Attention: The implementation of hard-coded CDN URLs may lead to an undesired result if the CDN resource is deactivated at a later point in time. If possible, all image paths should always be generated dynamically via the Shopware Media Manager.
Helpful links
Shopware Documentation: