Add attachment option for Content-Disposition header (#887)

* Add attachment option for Content-Disposition header

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>

* Add documentation to attachment option

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>

* Add default attachment option value

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>

* fix: Add default value to docs

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>

* fix: Rename option attachment to return_attachment, add ENV-configuration

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>
This commit is contained in:
Valentine Kiselev
2022-06-06 11:53:09 +03:00
committed by GitHub
parent e06dce6a49
commit 23d0807e46
6 changed files with 54 additions and 21 deletions

View File

@@ -421,5 +421,6 @@ imgproxy can send logs to syslog, but this feature is disabled by default. To en
* `IMGPROXY_STRIP_COLOR_PROFILE`: when `true`, imgproxy will transform the embedded color profile (ICC) to sRGB and remove it from the image. Otherwise, imgproxy will try to keep it as is. Default: `true`
* `IMGPROXY_AUTO_ROTATE`: when `true`, imgproxy will automatically rotate images based on the EXIF Orientation parameter (if available in the image meta data). The orientation tag will be removed from the image in all cases. Default: `true`
* `IMGPROXY_ENFORCE_THUMBNAIL`: when `true` and the source image has an embedded thumbnail, imgproxy will always use the embedded thumbnail instead of the main image. Currently, only thumbnails embedded in `heic` and `avif` are supported. Default: `false`
* `IMGPROXY_RETURN_ATTACHMENT`: when `true`, response header `Content-Disposition` will include `attachment`. Default: `false`
* `IMGPROXY_HEALTH_CHECK_MESSAGE`: <i class='badge badge-pro'></i> the content of the health check response. Default: `imgproxy is running`
* `IMGPROXY_HEALTH_CHECK_PATH`: an additional path of the health check. Default: blank

View File

@@ -529,6 +529,15 @@ eth:%enforce_thumbnail
When set to `1`, `t` or `true` and the source image has an embedded thumbnail, imgproxy will always use the embedded thumbnail instead of the main image. Currently, only thumbnails embedded in `heic` and `avif` are supported. This is normally controlled by the [IMGPROXY_ENFORCE_THUMBNAIL](configuration.md#miscellaneous) configuration but this procesing option allows the configuration to be set for each request.
### Return attachment
```
return_attachment:%return_attachment
att:%return_attachment
```
When set to `1`, `t` or `true`, imgproxy will return `attachment` in the `Content-Disposition` header, and the browser will open a 'Save as' dialog. This is normally controlled by the [IMGPROXY_RETURN_ATTACHMENT](configuration.md#miscellaneous) configuration but this procesing option allows the configuration to be set for each request.
### Quality
```