carrierwave-cloudflare 0.3.2 → 0.4.0

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
  SHA256:
3
- metadata.gz: 995cee5f213250acfd445e8e5a246273c1560f15eceb6f48acb115dc45865045
4
- data.tar.gz: a6ad5797dbe08b8c66efe7181e960384115cd37007686029e1ce20e62ed86b31
3
+ metadata.gz: 9e6c83dc0ef7c551b8993c4db9f98795eaf225a0dbfa871878e2addcb08b9755
4
+ data.tar.gz: 856b61f04aa55809719761cb12a7989b30f69b13ac057c2c146b363b543c79f7
5
5
  SHA512:
6
- metadata.gz: 3fe828b4f6014ada52ab7b8298af0791b6e32888b1b1943475bacc81c21dc6fd61394246814c713a645441ea72e930fca94865779f8c901dbab915a32d9b2ff6
7
- data.tar.gz: e917a114cf588fb87f711070ca281e658bac10747d5291c80e00d7554354de43e374e65b14e99e90f5533f18522e24eb90338a052ffa366a1b0f10f15c284bf9
6
+ metadata.gz: 6d37c37f600a27e199e4f5226e020f177c7bc11e3b8853d36daf7ad2670226affbb00403ca9ddaf27b52f146151eed7bdde3a618f5e364f463713072b3a9cbe4
7
+ data.tar.gz: d9a5822144d398a58cc2982cf8a9b4853e47c9423a14702b90dac12f08fdc9fef9d5e14dd1a82135db7f1fbbbaeba131e118ca960078ccd1a6efd92786882ea3
data/CHANGELOG.md CHANGED
@@ -0,0 +1,5 @@
1
+ CHANGELOG
2
+
3
+ == 0.4.0 (2022-07-18)
4
+
5
+ - Set `width` and `height` attributes to the image tag if values exist
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # Carrierwave::Cloudflare
1
+ # CarrierWave::Cloudflare
2
2
 
3
3
  [![Tests](https://github.com/resume-io/carrierwave-cloudflare/actions/workflows/run-specs.yml/badge.svg?branch=master)](https://github.com/resume-io/carrierwave-cloudflare/actions/workflows/run-specs.yml)
4
4
  [![Gem Version](https://badge.fury.io/rb/carrierwave-cloudflare.svg)](https://badge.fury.io/rb/carrierwave-cloudflare)
5
5
 
6
- This gem integrates CarrierWave with [Cloudflare Image Resizing](https://developers.cloudflare.com/images/)
6
+ This gem integrates CarrierWave with [Cloudflare Image Resizing](https://developers.cloudflare.com/images/image-resizing)
7
7
 
8
8
 
9
9
  ## Installation
@@ -18,7 +18,7 @@ And then execute:
18
18
 
19
19
  $ bundle install
20
20
 
21
- Or install it yourself as:
21
+ Or install it yourself with:
22
22
 
23
23
  $ gem install carrierwave-cloudflare
24
24
 
@@ -32,7 +32,7 @@ class BaseUploader < CarrierWave::Uploader::Base
32
32
  end
33
33
  ```
34
34
 
35
- Use `cdn_transform` for define Cloudflare's version (this means that now the file will not be stored on the, but will be transformed on the cloudflare side)
35
+ Use `cdn_transform` to define Cloudflare's version (this means that now the file will not be stored on a server, but will be transformed on the Cloudflare side)
36
36
 
37
37
  ```ruby
38
38
  class AvatarUploader < BaseUploader
@@ -56,9 +56,9 @@ Supported options:
56
56
 
57
57
  `width`, `height`, `dpr`, `fit`, `gravity`, `quality`, `format`, `onerror`, `metadata`
58
58
 
59
- See details in Cloudflare [documentation](https://developers.cloudflare.com/images/url-format)
59
+ See details in Cloudflare's [documentation](https://developers.cloudflare.com/images/url-format)
60
60
 
61
- Also, you can define default options (supports all options described above)
61
+ You can also define default options (supports all options described above)
62
62
 
63
63
  ```ruby
64
64
  class BaseUploader < CarrierWave::Uploader::Base
@@ -68,7 +68,7 @@ end
68
68
 
69
69
  ### In development env
70
70
 
71
- In development, you don't need to generate URLs for Cloudflare, because they will not work and therefore you need to disable the Cloudflare transform
71
+ In development you don't need to generate URLs for Cloudflare, because they will not work and therefore you need to disable the Cloudflare transform
72
72
 
73
73
  ``` ruby
74
74
  CarrierWave::Cloudflare.configure do |config|
@@ -76,10 +76,7 @@ CarrierWave::Cloudflare.configure do |config|
76
76
  end
77
77
  ```
78
78
 
79
- `cloudflare_transform: false` disables links generation and put all Cloudflare's arguments into query string (for easy debugging)
80
-
81
- e.g:
82
-
79
+ `cloudflare_transform: false` disables links generation and puts all Cloudflare's arguments into query string (for easy debugging)
83
80
  ```
84
81
  /1.jpg?cdn-cgi=width-11.height-300.fit-pad
85
82
  ```
@@ -100,7 +97,7 @@ cdn_transformed('/cdn-cgi/image/width=100,fit=pad/img.jpg', width: 333)
100
97
 
101
98
  ### hidpi_image_tag(url, dprs: nil, **options)
102
99
 
103
- Returns an image tag with with scaled variations (via `srcset`) attribute for devices with different DPR values.
100
+ Returns an image tag with scaled variations (via `srcset`) attribute for devices with different DPR values.
104
101
 
105
102
 
106
103
  The transformation of the original image should be specified via options.
@@ -131,6 +128,10 @@ responsive_image_tag('/bird.jpg', width: 1200, sizes: { phone: 600, tablet: 800
131
128
 
132
129
  ## Development
133
130
 
134
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
131
+ After checking out the repo, run `bin/setup` to install dependencies. Then run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
135
132
 
136
133
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
134
+
135
+ ## License
136
+
137
+ This project is licensed and distributed under the terms of the [MIT license](https://github.com/resume-io/carrierwave-cloudflare/blob/master/LICENSE.txt).
@@ -33,4 +33,5 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency "rack", "~> 2.0"
34
34
  spec.add_development_dependency "rake"
35
35
  spec.add_development_dependency "rspec"
36
+ spec.add_development_dependency "rubocop"
36
37
  end
@@ -47,6 +47,8 @@ module CarrierWave
47
47
  image_tag(
48
48
  cdn_transformed(url, **transform),
49
49
  srcset: hidpi_image_srcset(url, dprs: dprs, **transform),
50
+ width: transform[:width],
51
+ height: transform[:height],
50
52
  **rest
51
53
  )
52
54
  end
@@ -73,7 +75,7 @@ module CarrierWave
73
75
  url = url.url if url.is_a?(CarrierWave::Uploader)
74
76
 
75
77
  if sizes.nil?
76
- return hidpi_image_tag(url, **options)
78
+ return hidpi_image_tag(url, width: width, **options)
77
79
  end
78
80
 
79
81
  sizes[:default] = width
@@ -108,6 +110,8 @@ module CarrierWave
108
110
  base_version,
109
111
  srcset: srcset,
110
112
  sizes: sizes_attr,
113
+ width: width,
114
+ height: transform[:height],
111
115
  **rest
112
116
  )
113
117
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module CarrierWave
4
4
  module Cloudflare
5
- VERSION = "0.3.2"
5
+ VERSION = "0.4.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave-cloudflare
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Frost
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-08-02 00:00:00.000000000 Z
12
+ date: 2022-07-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview
@@ -109,6 +109,20 @@ dependencies:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: rubocop
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
112
126
  description:
113
127
  email:
114
128
  - cheerful.mf@gmail.com
@@ -157,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
171
  - !ruby/object:Gem::Version
158
172
  version: '0'
159
173
  requirements: []
160
- rubygems_version: 3.0.3
174
+ rubygems_version: 3.1.6
161
175
  signing_key:
162
176
  specification_version: 4
163
177
  summary: Wrapper for cloudflare transforming images