1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-12-14 10:02:57 +02:00
imgproxy/docs/presets.md

34 lines
1.2 KiB
Markdown
Raw Normal View History

2018-10-04 14:59:57 +02:00
# Presets
2021-03-15 13:26:38 +02:00
imgproxy preset is a named set of processing options. Presets can be used in [URLs](generating_the_url.md#preset) to make them shorter and somewhat readable.
2018-10-04 14:59:57 +02:00
2019-09-18 14:04:01 +02:00
## Presets definition
2018-10-04 14:59:57 +02:00
2018-10-08 08:23:20 +02:00
The preset definition looks like this:
2018-10-04 14:59:57 +02:00
```
%preset_name=%processing_options
```
2021-03-15 13:26:38 +02:00
Processing options should be defined in the same way as you define them in the [URLs](generating_the_url.md#processing-options). For example, here is a preset named `awesome` that sets the resizing type to `fill` and resulting format to `jpg`:
2018-10-04 14:59:57 +02:00
```
awesome=resizing_type:fill/format:jpg
```
2019-09-18 14:04:01 +02:00
Read how to specify your presets with imgproxy in the [Configuration](configuration.md) guide.
2018-10-04 14:59:57 +02:00
2019-09-18 14:04:01 +02:00
## Default preset
2018-10-04 14:59:57 +02:00
2018-10-08 08:23:20 +02:00
A preset named `default` will be applied to each image. Useful in case you want your default processing options to be different from the imgproxy default ones.
2019-09-18 14:04:01 +02:00
## Only presets
2019-05-16 13:15:57 +02:00
Setting `IMGPROXY_ONLY_PRESETS` as `true` switches imgproxy into "presets-only mode". In this mode imgproxy accepts presets list as processing options just like you'd specify them for the `preset` option:
2019-05-16 13:15:57 +02:00
```
http://imgproxy.example.com/unsafe/thumbnail:blurry:watermarked/plain/http://example.com/images/curiosity.jpg@png
```
2019-05-16 13:15:57 +02:00
All othe URL formats are disabled in this mode.