From 8a081a917e8d293c05b8a5d3184f0f974b384ae7 Mon Sep 17 00:00:00 2001 From: DarthSim Date: Mon, 5 Sep 2022 16:55:38 +0600 Subject: [PATCH] Rearrange processing options --- docs/generating_the_url.md | 18 +++++++++--------- options/processing_options.go | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/generating_the_url.md b/docs/generating_the_url.md index 408f08b9..9d7b99fc 100644 --- a/docs/generating_the_url.md +++ b/docs/generating_the_url.md @@ -529,15 +529,6 @@ 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 ``` @@ -706,6 +697,15 @@ Defines a filename for the `Content-Disposition` header. When not specified, img Default: empty +### 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. + ### Preset ``` diff --git a/options/processing_options.go b/options/processing_options.go index 538c4c00..2dc349bc 100644 --- a/options/processing_options.go +++ b/options/processing_options.go @@ -88,7 +88,6 @@ type ProcessingOptions struct { StripColorProfile bool AutoRotate bool EnforceThumbnail bool - ReturnAttachment bool SkipProcessingFormats []imagetype.Type @@ -101,7 +100,8 @@ type ProcessingOptions struct { PreferAvif bool EnforceAvif bool - Filename string + Filename string + ReturnAttachment bool UsedPresets []string @@ -916,8 +916,6 @@ func applyURLOption(po *ProcessingOptions, name string, args []string) error { return applyStripColorProfileOption(po, args) case "enforce_thumbnail", "eth": return applyEnforceThumbnailOption(po, args) - case "return_attachment", "att": - return applyReturnAttachmentOption(po, args) // Saving options case "quality", "q": return applyQualityOption(po, args) @@ -936,6 +934,8 @@ func applyURLOption(po *ProcessingOptions, name string, args []string) error { return applyExpiresOption(po, args) case "filename", "fn": return applyFilenameOption(po, args) + case "return_attachment", "att": + return applyReturnAttachmentOption(po, args) // Presets case "preset", "pr": return applyPresetOption(po, args)