imgix 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +15 -11
- data/lib/imgix/path.rb +4 -4
- data/lib/imgix/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d45f1a9130411b2b890ad779f5e67ffd506958d0c939d79e3eac2e7a1ff3a7c0
|
4
|
+
data.tar.gz: 9a1a729003bdb13dd0b390af5afe60b16e95691aa49f483fa6b37c1c0c27332f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 470a6ff91572f79a5d93d2040c5ce50d035e379739aa207e2af4b3a45d0c510042276d42c73839bbc154fc4d4112d913005cccfecdcee930ed36098a06d36055
|
7
|
+
data.tar.gz: 390c08cee470af444bc95140758fe39e108270df0e2ca6d66ac2b3e42c59665c7786ff99965652758a246b19a6486f12e19185528c8dad3c8bcc2fca5a93cd18
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,12 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## [4.0.1](https://github.com/imgix/imgix-rb/compare/4.0.0...4.0.1) - March 24, 2021
|
7
|
+
|
8
|
+
* fix: dpr srcset when only h param ([#101](https://github.com/imgix/imgix-rb/pull/101))
|
9
|
+
* docs: update travis badge to point to travis-ci.com ([#99](https://github.com/imgix/imgix-rb/pull/99))
|
10
|
+
* docs: fixed typo w/ srcset min/max widths ([#97](https://github.com/imgix/imgix-rb/pull/97))
|
11
|
+
|
6
12
|
## [4.0.0](https://github.com/imgix/imgix-rb/compare/3.4.0...4.0.0) - August 26, 2020
|
7
13
|
|
8
14
|
* deprecate: host-usage, param_helpers, and prefix-1-ary ([#91](https://github.com/imgix/imgix-rb/pull/91))
|
data/README.md
CHANGED
@@ -4,9 +4,10 @@
|
|
4
4
|
`imgix-rb` is a client library for generating image URLs with [imgix](https://www.imgix.com/). It is tested under Ruby versions `2.3.0`, `2.2.4`, `2.1.8`, `jruby-9.2.11.0`, and `rbx-3.107`.
|
5
5
|
|
6
6
|
[![Gem Version](https://img.shields.io/gem/v/imgix.svg)](https://rubygems.org/gems/imgix)
|
7
|
-
[![Build Status](https://travis-ci.
|
7
|
+
[![Build Status](https://travis-ci.com/imgix/imgix-rb.svg?branch=main)](https://travis-ci.com/imgix/imgix-rb)
|
8
8
|
![Downloads](https://img.shields.io/gem/dt/imgix)
|
9
9
|
[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/imgix/imgix-rb/blob/main/LICENSE)
|
10
|
+
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fimgix%2Fimgix-rb.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fimgix%2Fimgix-rb?ref=badge_shield)
|
10
11
|
|
11
12
|
---
|
12
13
|
<!-- /ix-docs-ignore -->
|
@@ -14,16 +15,16 @@
|
|
14
15
|
- [Installation](#installation)
|
15
16
|
- [Usage](#usage)
|
16
17
|
- [Srcset Generation](#srcset-generation)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
- [Multiple Parameters](#multiple-parameters)
|
18
|
+
* [Fixed image rendering](#fixed-image-rendering)
|
19
|
+
* [Custom Widths](#custom-widths)
|
20
|
+
* [Width Tolerance](#width-tolerance)
|
21
|
+
* [Minimum and Maximum Width Ranges](#minimum-and-maximum-width-ranges)
|
22
|
+
* [Variable Qualities](#variable-qualities)
|
23
23
|
- [Purge Cache](#purge-cache)
|
24
24
|
- [URL encoding and signed imgix URLs](#url-encoding-and-signed-imgix-urls)
|
25
25
|
- [What is the `ixlib` param on every request?](#what-is-the-ixlib-param-on-every-request)
|
26
26
|
- [Contributing](#contributing)
|
27
|
+
- [License](#license)
|
27
28
|
|
28
29
|
## Installation
|
29
30
|
|
@@ -79,7 +80,7 @@ https://your-subdomain.imgix.net/images/demo.png?w=8192&s=9fbd257c53e770e345ce34
|
|
79
80
|
|
80
81
|
### Fixed image rendering
|
81
82
|
|
82
|
-
In cases where enough information is provided about an image's dimensions, `to_srcset` will instead build a `srcset` that will allow for an image to be served at different resolutions. The parameters taken into consideration when determining if an image is fixed-width are `w
|
83
|
+
In cases where enough information is provided about an image's dimensions, `to_srcset` will instead build a `srcset` that will allow for an image to be served at different resolutions. The parameters taken into consideration when determining if an image is fixed-width are `w` or `h`. By invoking `to_srcset` with either a width **or** height provided, a different `srcset` will be generated for a fixed-size image instead.
|
83
84
|
|
84
85
|
```rb
|
85
86
|
client = Imgix::Client.new(domain: 'your-subdomain.imgix.net', secure_url_token: 'your-token', include_library_param: false)
|
@@ -144,11 +145,11 @@ https://testing.imgix.net/image.jpg?w=8192 8192w
|
|
144
145
|
|
145
146
|
### Minimum and Maximum Width Ranges
|
146
147
|
|
147
|
-
If the exact number of minimum/maximum physical pixels that an image will need to be rendered at is known, a user can specify them by passing an integer via `
|
148
|
+
If the exact number of minimum/maximum physical pixels that an image will need to be rendered at is known, a user can specify them by passing an integer via `min_width` and/or `max_width` to the `options` keyword parameters:
|
148
149
|
|
149
150
|
```rb
|
150
151
|
client = Imgix::Client.new(domain: 'testing.imgix.net', include_library_param: false)
|
151
|
-
client.path('image.jpg').to_srcset(options: {
|
152
|
+
client.path('image.jpg').to_srcset(options: { min_width: 500, max_width: 2000 })
|
152
153
|
```
|
153
154
|
|
154
155
|
Will result in a smaller, more tailored srcset.
|
@@ -167,7 +168,7 @@ https://testing.imgix.net/image.jpg?w=1902 1902w,
|
|
167
168
|
https://testing.imgix.net/image.jpg?w=2000 2000w
|
168
169
|
```
|
169
170
|
|
170
|
-
Remember that browsers will apply a device pixel ratio as a multiplier when selecting which image to download from a `srcset`. For example, even if you know your image will render no larger than 1000px, specifying `options: {
|
171
|
+
Remember that browsers will apply a device pixel ratio as a multiplier when selecting which image to download from a `srcset`. For example, even if you know your image will render no larger than 1000px, specifying `options: { max_width: 1000 }` will give your users with DPR higher than 1 no choice but to download and render a low-resolution version of the image. Therefore, it is vital to factor in any potential differences when choosing a minimum or maximum range.
|
171
172
|
|
172
173
|
Also please note that according to the [imgix API](https://docs.imgix.com/apis/url/size/w), the maximum renderable image width is 8192 pixels.
|
173
174
|
|
@@ -223,3 +224,6 @@ client = Imgix::Client.new(domain: 'your-subdomain.imgix.net', include_library_p
|
|
223
224
|
## Contributing
|
224
225
|
|
225
226
|
See the [contributing guide](Contributing.markdown).
|
227
|
+
|
228
|
+
## License
|
229
|
+
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fimgix%2Fimgix-rb.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fimgix%2Fimgix-rb?ref=badge_large)
|
data/lib/imgix/path.rb
CHANGED
@@ -53,7 +53,7 @@ module Imgix
|
|
53
53
|
height = @options[:h]
|
54
54
|
aspect_ratio = @options[:ar]
|
55
55
|
|
56
|
-
srcset = if width ||
|
56
|
+
srcset = if width || height
|
57
57
|
build_dpr_srcset(options: options, params: @options)
|
58
58
|
else
|
59
59
|
build_srcset_pairs(options: options, params: @options)
|
@@ -215,11 +215,11 @@ module Imgix
|
|
215
215
|
raise ArgumentError, widths_error unless all_positive_integers
|
216
216
|
end
|
217
217
|
|
218
|
-
def validate_range!(
|
218
|
+
def validate_range!(min_width, max_width)
|
219
219
|
range_numeric_error = "error: `min_width` and `max_width` must be positive `Numeric` values"
|
220
|
-
raise ArgumentError, range_numeric_error unless
|
220
|
+
raise ArgumentError, range_numeric_error unless min_width.is_a?(Numeric) && max_width.is_a?(Numeric)
|
221
221
|
|
222
|
-
raise ArgumentError, range_numeric_error unless
|
222
|
+
raise ArgumentError, range_numeric_error unless min_width > 0 && max_width > 0
|
223
223
|
end
|
224
224
|
|
225
225
|
def validate_variable_qualities!(disable_quality)
|
data/lib/imgix/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imgix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Sutton
|
@@ -10,10 +10,10 @@ authors:
|
|
10
10
|
- Antony Denyer
|
11
11
|
- Paul Straw
|
12
12
|
- Sherwin Heydarbeygi
|
13
|
-
autorequire:
|
13
|
+
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date:
|
16
|
+
date: 2021-03-25 00:00:00.000000000 Z
|
17
17
|
dependencies: []
|
18
18
|
description: Easily create and sign imgix URLs.
|
19
19
|
email:
|
@@ -47,9 +47,9 @@ licenses:
|
|
47
47
|
metadata:
|
48
48
|
bug_tracker_uri: https://github.com/imgix/imgix-rb/issues
|
49
49
|
changelog_uri: https://github.com/imgix/imgix-rb/blob/main/CHANGELOG.md
|
50
|
-
documentation_uri: https://www.rubydoc.info/gems/imgix/4.0.
|
51
|
-
source_code_uri: https://github.com/imgix/imgix-rb/tree/4.0.
|
52
|
-
post_install_message:
|
50
|
+
documentation_uri: https://www.rubydoc.info/gems/imgix/4.0.1
|
51
|
+
source_code_uri: https://github.com/imgix/imgix-rb/tree/4.0.1
|
52
|
+
post_install_message:
|
53
53
|
rdoc_options: []
|
54
54
|
require_paths:
|
55
55
|
- lib
|
@@ -64,8 +64,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
- !ruby/object:Gem::Version
|
65
65
|
version: '0'
|
66
66
|
requirements: []
|
67
|
-
rubygems_version: 3.
|
68
|
-
signing_key:
|
67
|
+
rubygems_version: 3.2.3
|
68
|
+
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: Official Ruby Gem for easily creating and signing imgix URLs.
|
71
71
|
test_files: []
|