imgproxy-rails 0.2.0 → 0.3.0
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 +12 -1
- data/config/routes.rb +12 -0
- data/lib/imgproxy-rails/helpers.rb +7 -3
- data/lib/imgproxy-rails/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6974de3a0a3e639db48c61d91831744442c8ac5a5d6e9d4525985896e6b2a01
|
4
|
+
data.tar.gz: d081d8571ca8a0cd940839cb97016abf74138158dfe4c0135a45368842c8d007
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ad05883a46086a42ea605d2f978c9f57ef0da2d412b3c2f0443eddc25e62a93727d975459c69299314522e42176435bcbeed20e7b62ea2ba47c24da2bd9d4c1
|
7
|
+
data.tar.gz: 177fe43bf90c218934bd705d155bc10812493c8e427d8eed10e81561849d443eacd90c453d6e294655b2307ce165d8dad0b155baf6c790cd2b43f72abf6b7e85
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 0.3.0 (2023-12-27)
|
6
|
+
|
7
|
+
- Added support for `video/*` and `application/pdf` content types. ([@DarthSim][])
|
8
|
+
|
9
|
+
- `config/routes.rb` added to gemspec files ([@chloerei][])
|
10
|
+
|
5
11
|
## 0.2.0 (2023-10-26)
|
6
12
|
|
7
13
|
- Improved `resize_and_pad` support. ([@palkan][])
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
---
|
20
20
|
|
21
|
-
Integration of [imgproxy.rb](https://github.com/imgproxy/imgproxy.rb) with [ActiveStorage::Variant API](https://edgeapi.rubyonrails.org/classes/ActiveStorage/Variant.
|
21
|
+
Integration of [imgproxy.rb](https://github.com/imgproxy/imgproxy.rb) with [ActiveStorage::Variant API](https://edgeapi.rubyonrails.org/classes/ActiveStorage/Variant.html).
|
22
22
|
|
23
23
|
## Installation
|
24
24
|
|
@@ -76,6 +76,17 @@ You can also specify imgproxy-specific parameters in `imgproxy_options` attribut
|
|
76
76
|
Current.user.avatar.variant(resize: "100x100", imgproxy_options: {height: 50, width: 50})
|
77
77
|
```
|
78
78
|
|
79
|
+
### Generating video and PDF previews
|
80
|
+
|
81
|
+
If you are an imgproxy Pro user and you want to use it to generate previews for your videos and PDFs, just add their content types to the `variable_content_types` list:
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
config.active_storage.variable_content_types << "application/pdf"
|
85
|
+
config.active_storage.variable_content_types << "video/mp4"
|
86
|
+
config.active_storage.variable_content_types << "video/mov"
|
87
|
+
# ...etc
|
88
|
+
```
|
89
|
+
|
79
90
|
## Contributing
|
80
91
|
|
81
92
|
Bug reports and pull requests are welcome on GitHub at [https://github.com/imgproxy/imgproxy-rails](https://github.com/imgproxy/imgproxy-rails).
|
data/config/routes.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Rails.application.routes.draw do
|
4
|
+
direct :imgproxy_active_storage do |model, options|
|
5
|
+
if ImgproxyRails::Helpers.applicable_variation?(model)
|
6
|
+
transformations = model.variation.transformations
|
7
|
+
Imgproxy.url_for(model.blob, ImgproxyRails::Transformer.call(transformations))
|
8
|
+
else
|
9
|
+
route_for(:rails_storage_proxy, model, options)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -2,9 +2,13 @@
|
|
2
2
|
|
3
3
|
module ImgproxyRails
|
4
4
|
module Helpers
|
5
|
-
def self.
|
6
|
-
model.respond_to?(:variation)
|
7
|
-
|
5
|
+
def self.applicable_variation?(model)
|
6
|
+
return false if !model.respond_to?(:variation)
|
7
|
+
|
8
|
+
content_type = model.try(:blob)&.content_type
|
9
|
+
content_type&.start_with?("image/") ||
|
10
|
+
content_type&.start_with?("video/") ||
|
11
|
+
content_type == "application/pdf"
|
8
12
|
end
|
9
13
|
end
|
10
14
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imgproxy-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-12-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: imgproxy
|
@@ -148,6 +148,7 @@ files:
|
|
148
148
|
- CHANGELOG.md
|
149
149
|
- LICENSE.txt
|
150
150
|
- README.md
|
151
|
+
- config/routes.rb
|
151
152
|
- lib/imgproxy-rails.rb
|
152
153
|
- lib/imgproxy-rails/engine.rb
|
153
154
|
- lib/imgproxy-rails/helpers.rb
|
@@ -177,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
178
|
- !ruby/object:Gem::Version
|
178
179
|
version: '0'
|
179
180
|
requirements: []
|
180
|
-
rubygems_version: 3.
|
181
|
+
rubygems_version: 3.3.26
|
181
182
|
signing_key:
|
182
183
|
specification_version: 4
|
183
184
|
summary: integration of imgproxy.rb with ActiveStorage::Variant API
|