Skip to content

Commit b157002

Browse files
committed
Update docs, README, and gemspec; Add changelog
1 parent b51224e commit b157002

9 files changed

Lines changed: 320 additions & 162 deletions

File tree

.yardopts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
--asset logo:logo
22
--load docs/yard/fix_pictures.rb
33
--load docs/yard/relative_markdown_links.rb
4+
--load docs/yard/github_alerts.rb
45
-
5-
2.0-Upgrade.md
6+
CHANGELOG.md
7+
UPGRADE.md
68
docs/*.md

2.0-Upgrade.md

Lines changed: 0 additions & 98 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<!--
2+
# @title Changelog
3+
-->
4+
# Changelog
5+
6+
## [Unreleased]
7+
8+
⚠️ This is a major release. See [the migration guide](https://github.com/imgproxy/imgproxy.rb/blob/master/UPGRADE.md). ⚠️
9+
10+
### Added
11+
- Added info options support.
12+
- Added missing processing options.
13+
- Added ecrypted source URLs support.
14+
- Added extra services support.
15+
16+
## [2.1.0] - 2022-06-14
17+
### Added
18+
- Add `ActiveStorage::Service::MirrorService` support.
19+
- Add `expires` and `return_attachment` options support.
20+
21+
## [2.0.0] - 2021-03-02
22+
23+
⚠️ This is a major release. See [the migration guide](https://github.com/imgproxy/imgproxy.rb/blob/master/UPGRADE.md). ⚠️
24+
25+
### Added
26+
- Added missing processing options.
27+
28+
### Changed
29+
- New processing options format.
30+
- Active Storage and Shrine extensions are enabled _automagially_.
31+
- Active Storage and Shrine extensions options are moved to the config.
32+
- The gem can be configured with environment variables or config files. Thanks to [anyway_config](https://github.com/palkan/anyway_config).
33+
- Unsupported processing options can be used with some limitations.
34+
- `hex_key` and `hex_salt` config options are renamed to `key` and `salt`. `key` and `salt` config options are renamed to `raw_key` and `raw_salt`.
35+
36+
## [1.1.0] - 2019-10-14
37+
### Added
38+
- Add crop options;
39+
- Add adjustment options;
40+
- Add `pixelate` option;
41+
- Add `watermark_url` option.
42+
43+
## [1.0.6] - 2019-09-24
44+
### Fixed
45+
- Escape spaces in source URLs;
46+
- Fix URL combination.
47+
48+
## [1.0.5] - 2019-09-04
49+
### Fixed
50+
- Fix non-ascii URLs support
51+
52+
## [1.0.4] - 2019-08-22
53+
### Fixed
54+
- Only set host to Shrine if it presents
55+
56+
## [1.0.3] - 2019-08-21
57+
### Fixed
58+
- Don't modify builder options
59+
60+
## [1.0.2] - 2019-04-08
61+
### Added
62+
- Add host option to Imgproxy.extend_shrine!
63+
64+
### Changed
65+
- Check Active Storage attachment service instead of ::ActiveStorage::Blob.service
66+
- Better URL combination
67+
68+
## [1.0.1] - 2019-04-03
69+
### Fixed
70+
- Fixed URL signing
71+
72+
## [1.0.0] - 2019-04-03
73+
### Added
74+
- First production-ready release

README.md

Lines changed: 51 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,19 @@
1717

1818
---
1919

20-
**[imgproxy](https://imgproxy.net)** is a fast and secure standalone server for resizing and converting remote images. The main principles of imgproxy are simplicity, speed, and security. It is a Go application, ready to be installed and used in any Unix environment—also ready to be containerized using Docker.
20+
[imgproxy](https://imgproxy.net) is a fast and secure standalone server for resizing and converting remote images. The main principles of imgproxy are simplicity, speed, and security. It is a Go application, ready to be installed and used in any Unix environment—also ready to be containerized using Docker.
2121

2222
imgproxy can be used to provide a fast and secure way to _get rid of all the image resizing code_ in your web application (like calling ImageMagick or GraphicsMagick, or using libraries), while also being able to resize everything on the fly on a separate server that only you control. imgproxy is fast, easy to use, and requires zero processing power or storage from the main application. imgproxy is indispensable when handling image resizing of epic proportions, especially when original images are coming from a remote source.
2323

2424
[imgproxy.rb](https://github.com/imgproxy/imgproxy.rb) is a framework-agnostic Ruby Gem for imgproxy that includes proper support for Ruby on Rails' most popular image attachment options: [Active Storage](https://edgeguides.rubyonrails.org/active_storage_overview.html) and [Shrine](https://github.com/shrinerb/shrine).
2525

26-
**NOTE:** this readme shows documentation for 2.x version. For version 1.x see the [v1.2.0](https://github.com/imgproxy/imgproxy.rb/tree/v1.2.0) tag. See [2.0-Upgrade.md](2.0-Upgrade.md) for the upgrade guide.
26+
> [!IMPORTANT]
27+
> This readme shows documentation for version 3.x.
28+
>
29+
> * For version 2.x see the [v2.1.0](https://github.com/imgproxy/imgproxy.rb/tree/v2.1.0) tag
30+
> * For version 1.x see the [v1.2.0](https://github.com/imgproxy/imgproxy.rb/tree/v1.2.0) tag
31+
>
32+
> See [Upgrading imgproxy.rb](UPGRADE.md) for the upgrade guide.
2733
2834
## Installation
2935

@@ -35,15 +41,15 @@ gem "imgproxy"
3541

3642
or install system-wide:
3743

38-
```
44+
```bash
3945
gem install imgproxy
4046
```
4147

4248
## Configuration
4349

4450
imgproxy.rb uses [anyway_config](https://github.com/palkan/anyway_config) to load configuration, so you can configure it in different ways.
4551

46-
- With a separate config file:
52+
With a separate config file:
4753

4854
```yaml
4955
# <Rails root>/config/imgproxy.yml
@@ -57,7 +63,7 @@ production: ...
5763
test: ...
5864
```
5965
60-
- With a `secrets.yml` entry for imgproxy:
66+
With a `secrets.yml` entry for imgproxy:
6167

6268
```yaml
6369
# secrets.yml
@@ -72,7 +78,7 @@ production:
7278
...
7379
```
7480

75-
- With environment variables:
81+
With environment variables:
7682

7783
```bash
7884
IMGPROXY_ENDPOINT="http://imgproxy.example.com" \
@@ -81,7 +87,7 @@ IMGPROXY_SALT="your_salt" \
8187
rails s
8288
```
8389

84-
- ...or right in your application code:
90+
...or right in your application code:
8591

8692
```ruby
8793
# config/initializers/imgproxy.rb
@@ -97,22 +103,22 @@ end
97103

98104
### Configuration options
99105

100-
- **endpoint** (`IMGPROXY_ENDPOINT`) - Full URL to your imgproxy instance. Default: `nil`.
101-
- **key** (`IMGPROXY_KEY`) - Hex-encoded signature key. Default: `nil`.
102-
- **salt** (`IMGPROXY_SALT`) - Hex-encoded signature salt. Default: `nil`.
103-
- **raw_key** (`IMGPROXY_RAW_KEY`) - Raw (not hex-encoded) signature key. Default: `nil`.
104-
- **raw_salt** (`IMGPROXY_RAW_SALT`) - Raw (not hex-encoded) signature salt. Default: `nil`.
105-
- **signature_size** (`IMGPROXY_SIGNATURE_SIZE`) - Signature size. See [URL signature](https://docs.imgproxy.net/configuration/options#url-signature) section of imgproxy docs. Default: 32.
106-
- **use_short_options** (`IMGPROXY_USE_SHORT_OPTIONS`) - Use short processing options names (`rs` for `resize`, `g` for `gravity`, etc). Default: true.
107-
- **base64_encode_urls** (`IMGPROXY_BASE64_ENCODE_URLS`) - Encode source URLs to base64. Default: false.
108-
- **always_escape_plain_urls** (`IMGPROXY_ALWAYS_ESCAPE_PLAIN_URLS`) - Always escape plain source URLs even when ones don't need to be escaped. Default: false.
109-
- **source_url_encryption_key** (`IMGPROXY_SOURCE_URL_ENCRYPTION_KEY`) - Hex-encoded source URL encryption key. Default: `nil`.
110-
- **raw_source_url_encryption_key** (`IMGPROXY_RAW_SOURCE_URL_ENCRYPTION_KEY`) - Raw (not hex-encoded) source URL encryption key. Default: `nil`.
111-
- **always_encrypt_source_urls** (`IMGPROXY_ALWAYS_ENCRYPT_SOURCE_URLS`) - Always encrypt source URLs. Default: false.
112-
- **use_s3_urls** (`IMGPROXY_USE_S3_URLS`) - Use `s3://...` source URLs for Active Storage and Shrine attachments stored in Amazon S3. Default: false.
113-
- **use_gcs_urls** (`IMGPROXY_USE_GCS_URLS`) - Use `gs://...` source URLs for Active Storage and Shrine attachments stored in Google Cloud Storage. Default: false.
114-
- **gcs_bucket** (`IMGPROXY_GCS_BUCKET`) - Google Cloud Storage bucket name. Default: `nil`.
115-
- **shrine_host** (`IMGPROXY_SHRINE_HOST`) - Shrine host for locally stored files.
106+
* `endpoint` (`IMGPROXY_ENDPOINT`) - Full URL to your imgproxy instance. Default: `nil`.
107+
* `key` (`IMGPROXY_KEY`) - Hex-encoded signature key. Default: `nil`.
108+
* `salt` (`IMGPROXY_SALT`) - Hex-encoded signature salt. Default: `nil`.
109+
* `raw_key` (`IMGPROXY_RAW_KEY`) - Raw (not hex-encoded) signature key. Default: `nil`.
110+
* `raw_salt` (`IMGPROXY_RAW_SALT`) - Raw (not hex-encoded) signature salt. Default: `nil`.
111+
* `signature_size` (`IMGPROXY_SIGNATURE_SIZE`) - Signature size. See [URL signature](https://docs.imgproxy.net/configuration/options#url-signature) section of imgproxy docs. Default: 32.
112+
* `use_short_options` (`IMGPROXY_USE_SHORT_OPTIONS`) - Use short processing options names (`rs` for `resize`, `g` for `gravity`, etc). Default: true.
113+
* `base64_encode_urls` (`IMGPROXY_BASE64_ENCODE_URLS`) - Encode source URLs to base64. Default: false.
114+
* `always_escape_plain_urls` (`IMGPROXY_ALWAYS_ESCAPE_PLAIN_URLS`) - Always escape plain source URLs even when ones don't need to be escaped. Default: false.
115+
* `source_url_encryption_key` (`IMGPROXY_SOURCE_URL_ENCRYPTION_KEY`) - Hex-encoded source URL encryption key. Default: `nil`.
116+
* `raw_source_url_encryption_key` (`IMGPROXY_RAW_SOURCE_URL_ENCRYPTION_KEY`) - Raw (not hex-encoded) source URL encryption key. Default: `nil`.
117+
* `always_encrypt_source_urls` (`IMGPROXY_ALWAYS_ENCRYPT_SOURCE_URLS`) - Always encrypt source URLs. Default: false.
118+
* `use_s3_urls` (`IMGPROXY_USE_S3_URLS`) - Use `s3://...` source URLs for Active Storage and Shrine attachments stored in Amazon S3. Default: false.
119+
* `use_gcs_urls` (`IMGPROXY_USE_GCS_URLS`) - Use `gs://...` source URLs for Active Storage and Shrine attachments stored in Google Cloud Storage. Default: false.
120+
* `gcs_bucket` (`IMGPROXY_GCS_BUCKET`) - Google Cloud Storage bucket name. Default: `nil`.
121+
* `shrine_host` (`IMGPROXY_SHRINE_HOST`) - Shrine host for locally stored files.
116122

117123
## Usage
118124

@@ -150,7 +156,8 @@ If you have configured both your imgproxy server and Active Storage to work with
150156

151157
You can also enable `gs://...` URLs usage for the files stored in Google Cloud Storage with `use_gcs_urls` and `gcs_bucket` config options (or `IMGPROXY_USE_GCS_URLS` and `IMGPROXY_GCS_BUCKET` env variables).
152158

153-
**NOTE** that you need to explicitly provide GCS bucket name since Active Storage "hides" the GCS config.
159+
> [!IMPORTANT]
160+
> You need to explicitly provide GCS bucket name since Active Storage "hides" the GCS config.
154161

155162
### Using with Shrine
156163

@@ -178,13 +185,14 @@ user.avatar.imgproxy_info_url(detect_objects: true, palette: 128)
178185

179186
This method will return a URL to the JSON with the requested info about your user's avatar.
180187

181-
**NOTE:** If you use `Shrine::Storage::FileSystem` as storage, uploaded file URLs won't include the hostname, so imgproxy server won't be able to access them. To fix this, use `shrine_host` config.
182-
183-
Alternatively, you can launch your imgproxy server with the `IMGPROXY_BASE_URL` setting:
184-
185-
```
186-
IMGPROXY_BASE_URL="http://your-host.test" imgproxy
187-
```
188+
> [!IMPORTANT]
189+
> If you use `Shrine::Storage::FileSystem` as storage, uploaded file URLs won't include the hostname, so imgproxy server won't be able to access them. To fix this, use `shrine_host` config.
190+
>
191+
> Alternatively, you can launch your imgproxy server with the `IMGPROXY_BASE_URL` setting:
192+
>
193+
> ```
194+
> IMGPROXY_BASE_URL="http://your-host.test" imgproxy
195+
> ```
188196

189197
#### Amazon S3
190198

@@ -243,11 +251,11 @@ info_builder.url_for("http://images.example.com/images/image2.jpg")
243251

244252
### Common options
245253

246-
- `base64_encode_url` — per-call redefinition of `base64_encode_urls` config.
247-
- `escape_plain_url` — per-call redefinition of `always_escape_plain_urls` config.
248-
- `use_short_options` — per-call redefinition of `use_short_options` config.
249-
- `encrypt_source_url` - _(pro)_ per-call redefinition of `always_encrypt_source_urls` config.
250-
- `source_url_encryption_iv` - _(pro)_ an initialization vector (IV) to be used for the source URL encryption if encryption is needed. If not specified, a random IV is used.
254+
* `base64_encode_url` — per-call redefinition of `base64_encode_urls` config.
255+
* `escape_plain_url` — per-call redefinition of `always_escape_plain_urls` config.
256+
* `use_short_options` — per-call redefinition of `use_short_options` config.
257+
* `encrypt_source_url` - _(pro)_ per-call redefinition of `always_encrypt_source_urls` config.
258+
* `source_url_encryption_iv` - _(pro)_ an initialization vector (IV) to be used for the source URL encryption if encryption is needed. If not specified, a random IV is used.
251259

252260
### Processing options
253261

@@ -331,7 +339,7 @@ Imgproxy.url_for(
331339

332340
### Base64 processing options arguments
333341

334-
Some of the processing options like `watermark_url` or `style` require their arguments to be base64-encoded. Good news is that imgproxy gem will encode them for you:
342+
Some of the processing options like `watermark_url` or `style` require their arguments to be base64-encoded. Good news is that imgproxy.rb will encode them for you:
335343

336344
```ruby
337345
Imgproxy.url_for(
@@ -346,6 +354,9 @@ Imgproxy.url_for(
346354

347355
By default, `Imgproxy.url_for` accepts only `String` and `URI` as the source URL, but you can extend that behavior by using URL adapters.
348356

357+
> [!TIP]
358+
> imgproxy.rb provides built-in adapters for Active Storage and Shrine that are automatically added when Active Storage or Shrine support is enabled.
359+
349360
URL adapter is a simple class that implements `applicable?` and `url` methods. See the example below:
350361

351362
```ruby
@@ -369,11 +380,10 @@ Imgproxy.configure do |config|
369380
end
370381
```
371382

372-
**NOTE:** imgproxy.rb provides built-in adapters for Active Storage and Shrine that are automatically added when Active Storage or Shrine support is enabled.
373-
374-
**NOTE:** `Imgproxy` will use the first applicable URL adapter. If you need to add your adapter to the beginning of the list, use the `prepend` method instead of `add`.
383+
> [!NOTE]
384+
> `Imgproxy` will use the first applicable URL adapter. If you need to add your adapter to the beginning of the list, use the `prepend` method instead of `add`.
375385
376-
## Custom services
386+
## Extra services
377387

378388
If you use more than one instance of imgproxy and they have different endpoints and key/salt configurations you can specify them in `services` option.
379389

0 commit comments

Comments
 (0)