imgix-rails 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +16 -2
- data/lib/imgix/rails/version.rb +1 -1
- data/lib/imgix/rails/view_helper.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 633c3e0220a49850cb94df32e86fef34efe3f56c
|
4
|
+
data.tar.gz: 522d0bfa5a0d2ae72931b67d905e773ec0e7ba9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0ffe1d93295403d4c214369060aabc34fbf4e800e077954271c025deb8ae129bac7c304f5092f2eba4ec19600da605d7926b6bcd209a855560cbf60bc76c387
|
7
|
+
data.tar.gz: 602ba9fce38ba0976ab3e3e106aadc4418714b8139bebe4f2a7247fcf6771a7ba3394e67951530ce908dbe0e6b244e5ee687ae67baad81265f13db32f25ba695
|
data/README.md
CHANGED
@@ -38,10 +38,10 @@ end
|
|
38
38
|
|
39
39
|
The following configuration flags will be respected:
|
40
40
|
|
41
|
-
- `:secure:` toggles the use of HTTPS.
|
41
|
+
- `:secure:` toggles the use of HTTPS. Defaults to `true`
|
42
42
|
- `:source` a String or Array that specifies the imgix Source address. Should be in the form of `"assets.imgix.net"`.
|
43
43
|
- `:secure_url_token` a optional secure URL token found in your dashboard (https://webapp.imgix.com) used for signing requests
|
44
|
-
- `:
|
44
|
+
- `:hostnames_to_replace` an Array of hostnames to replace with the value(s) specified by `:source`. This is useful if you store full-qualified S3 URLs in your database, but want to serve images through imgix.
|
45
45
|
|
46
46
|
### ix_image_tag
|
47
47
|
|
@@ -115,6 +115,20 @@ Will generate the following HTML:
|
|
115
115
|
</picture>
|
116
116
|
```
|
117
117
|
|
118
|
+
### ix_image_url
|
119
|
+
|
120
|
+
The `ix_image_url` helper makes it easy to generate a URL to an image in your Rails app.
|
121
|
+
|
122
|
+
```erb
|
123
|
+
<%= ix_image_url('/users/1/avatar.png', { w: 400, h: 300 }) %>
|
124
|
+
```
|
125
|
+
|
126
|
+
Will generate the following URL:
|
127
|
+
|
128
|
+
```html
|
129
|
+
https://assets.imgix.net/users/1/avatar.png?w=400&h=300
|
130
|
+
```
|
131
|
+
|
118
132
|
### Hostname Removal
|
119
133
|
|
120
134
|
You can also configure imgix-rails to disregard given hostnames and only use the path component from given URLs. This is useful if you have [a Web Folder or an Amazon S3 imgix Source configured](https://www.imgix.com/docs/tutorials/creating-sources) but store the fully-qualified URLs for those resources in your database.
|
data/lib/imgix/rails/version.rb
CHANGED
@@ -62,7 +62,7 @@ module Imgix
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def client
|
65
|
-
return @
|
65
|
+
return @imgix_client if @imgix_client
|
66
66
|
imgix = ::Imgix::Rails.config.imgix
|
67
67
|
|
68
68
|
opts = {
|
@@ -84,7 +84,7 @@ module Imgix
|
|
84
84
|
opts[:secure] = imgix[:secure]
|
85
85
|
end
|
86
86
|
|
87
|
-
@
|
87
|
+
@imgix_client = ::Imgix::Client.new(opts)
|
88
88
|
end
|
89
89
|
|
90
90
|
def available_parameters
|
@@ -101,7 +101,7 @@ module Imgix
|
|
101
101
|
configured_resolutions.map do |resolution|
|
102
102
|
srcset_options = options.slice(*available_parameters)
|
103
103
|
srcset_options[:dpr] = resolution unless resolution == 1
|
104
|
-
|
104
|
+
"#{ix_image_url(source, srcset_options)} #{resolution}x"
|
105
105
|
end.join(', ')
|
106
106
|
end
|
107
107
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imgix-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Sutton
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: imgix
|