Skip to content

Remote Thumbnail Generation

Remote Thumbnail Generation

INFO

This feature is available starting with Shopware version 6.6.4.0

In certain scenarios, you might want to disable the filesystem thumbnail generation in Shopware and use an external CDN service to handle the thumbnails. This can be beneficial for performance and scalability reasons. When the remote thumbnail configuration is enabled, the thumbnail images and thumbnail records in the database are not generated by Shopware, but by the external service.

Configuration

To use remote thumbnails, you need to adjust the following parameters in your config/packages/shopware.yaml:

yaml
shopware:
  media:
    remote_thumbnails:
      enable: true
      pattern: '{mediaUrl}/{mediaPath}?width={width}&ts={mediaUpdatedAt}'
  1. shopware.media.remote_thumbnails.enable: Set this parameter to true to enable remote thumbnails.

  2. shopware.media.remote_thumbnails.pattern: This parameter defines the URL pattern for your remote thumbnails. Replace it with your actual URL pattern.

The pattern supports the following variables:

  • mediaUrl: The base URL of the media file.
  • mediaPath: The media file path relative to the mediaUrl.
  • width: The width of the thumbnail.
  • height: The height of the thumbnail.
  • mediaUpdatedAt: The timestamp of the last media change.

For example, by default, the pattern was set as {mediaUrl}/{mediaPath}?width={width}&ts={mediaUpdatedAt}, the thumbnail URL would be generated as https://yourshop.example/abc/123/456.jpg?width=80&ts=1718954838.

Usage

Once the configuration is set, Shopware will automatically use the defined pattern to generate thumbnail URLs. These URLs will point to the external CDN service, which should handle generating and delivering the thumbnail images.

Please note that the external service needs to be able to handle the URL pattern and generate the appropriate thumbnails based on the provided parameters.

Conclusion

By using remote thumbnails, you can offload the task of thumbnail generation to an external service, potentially improving the performance and scalability of your Shopware installation.