imgix-rails 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b59ca66259f3a3dc2ce4dfe1e08319eaa81686d3
4
- data.tar.gz: 50d1153dcc0cb4357a626e5227b4554b1821cc3e
3
+ metadata.gz: 633c3e0220a49850cb94df32e86fef34efe3f56c
4
+ data.tar.gz: 522d0bfa5a0d2ae72931b67d905e773ec0e7ba9a
5
5
  SHA512:
6
- metadata.gz: 2c3f392e98b1309c410c41743d8eeba378c354643398abad7eb822f6c9c06bb40dd163a148fcd80f2cfd2d131a9d5dbd02003e52d26a65191ea483ad0aed8032
7
- data.tar.gz: 99687dfe26742019b14f742500d189843ca28ebabd09c25f44e589ab96dbedec732db1151100c52d6e752aa66a9f2fdcd3f991d91260f46bac9bb5761162e86f
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. Deafults to `true`
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
- - `:hostnames_to_remove` 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.
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.
@@ -1,5 +1,5 @@
1
1
  module Imgix
2
2
  module Rails
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  end
@@ -62,7 +62,7 @@ module Imgix
62
62
  end
63
63
 
64
64
  def client
65
- return @client if @client
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
- @client = ::Imgix::Client.new(opts)
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
- client.path(source).to_url(srcset_options) + " #{resolution}x"
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.0
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-09-04 00:00:00.000000000 Z
11
+ date: 2015-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: imgix