netlogix / nlx-sw-imgproxy
Plugin to allow shopware to authenticate and support image proxy
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 7
Forks: 0
Type:shopware-platform-plugin
Requires
Requires (Dev)
- php: >= 8.3
- ergebnis/composer-normalize: ^2.47
- netlogix/coding-guidelines-php: ^1.0
- phpunit/phpunit: ^12.0
README
This plugin adds remoteThumbnail support for imgproxy.
Installation
composer require netlogix/nlx-sw-imgproxy
Configuration
You can configure the plugin over the Shopware plugin configuration or add the following configuration to your config/packages/shopware.yaml
file:
option | default | description |
---|---|---|
enable | false | |
baseUrl | null | The imgproxy baseUrl |
resizeType | null | The resize type for imgproxy |
imageSource | null | The image source for imgproxy |
key | null | The key for signing a URL |
salt | null | The salt for signing a URL |
Only if enable
is set to true
and baseUrl
is defined, the plugin will use imgproxy to generate remote thumbnails.
Only if key and salt are set, the plugin will sign the URLs.
Granular imgproxy configuration
There are two ways to add additional processing options for imgproxy:
imgproxy presets - recommended
Define a default preset in your imgproxy. for example:
IMGPROXY_PRESETS="default=q:85"
Decorate the UrlGenerator::getImagePath
extension
You can decorate the UrlGenerator
to add additional processing options for imgproxy.
This method getImagePath
allows you to modify the URL path that is generated by the plugin.
Usage
You need an instance of imgproxy running to use this plugin.
You can run it locally or in a docker container darthsim/imgproxy
.
You have to enable remote_thumbnails
shopware: media: remote_thumbnails: enable: true
I recommend use the shopware.system_config
to configure the plugin.
for example in your config/packages/shopware.yaml
file:
shopware: system_config: default: NlxSwImgproxy.config.enable: true NlxSwImgproxy.config.baseUrl: 'https://public.imgproxy.domain' NlxSwImgproxy.config.key: '%env(IMGPROXY_KEY)%' NlxSwImgproxy.config.salt: '%env(IMGPROXY_SALT)%'