Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fruitcake/magento2-custom-image-url

Magento2 Custom Image URLS for the catalog (like Imgproxy)
https://github.com/fruitcake/magento2-custom-image-url

Last synced: 5 days ago
JSON representation

Magento2 Custom Image URLS for the catalog (like Imgproxy)

Awesome Lists containing this project

README

        

# Magento2 Custom Image Url

Magento 2.4 has the option to set a dynamic URL (General -> Web -> Url options).
This module adds an extra option to define the format of the URL.

## Install

```
composer require fruitcake/magento2-custom-image-url
php bin/magento module:enable Fruitcake_CustomImageUrl
php bin/magento setup:upgrade
```

## Configuration

You can configure the url in General -> Web -> Url Options. Set the 'Catalog media URL format' option to 'Image optimization based on query parameters'.
This will prevent Magento from creating resized images. Select a Custom URL format for Imgproxy or Pattern, to use this module.

![image](https://user-images.githubusercontent.com/973269/108608605-6cbe5b00-73c8-11eb-90dd-37777dc5d64c.png)

### Pattern

Provide a pattern to replace the URL with:

Example https://example.com/{{path}}?w={{width}}&h={{height}}

The available filters (for urlencode etc) and variables are described in the config.

### Imgproxy

![image](https://user-images.githubusercontent.com/973269/108608636-94152800-73c8-11eb-88bc-da2d6b4ed4c0.png)

Use the Imgproxy format, either with URL, S3 or Local files. You can provide a key/hash to sign the URLs

This can be used with the AWS Remote storage: https://devdocs.magento.com/guides/v2.4/config-guide/remote-storage/config-remote-storage-aws-s3.html

You can provide the host and options. The format will be generated by the module.

Inscecure proxy to map the URL + Convert to Webp:

`docker run -p 8080:8080 -e IMGPROXY_ENFORCE_WEBP=1 darthsim/imgproxy`

Example Docker config to proxy with S3 + Signature

`docker run -p 8080:8080 -e IMGPROXY_USE_S3=1 -e AWS_ACCESS_KEY_ID=accesskey -e IMGPROXY_S3_REGION=eu-central-1 -e AWS_SECRET_ACCESS_KEY="secret" -e IMGPROXY_KEY=key -e IMGPROXY_SALT=salt darthsim/imgproxy`

See https://docs.imgproxy.net/ for more options.

See imgproxy-nginx-cached.conf for an example nginx proxy config with caching enabled.

## Todo / future ideas

- Other CDNs
- ..

## License

MIT