fileboost 0.2.0.pre → 0.2.0.pre3
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 +146 -8
- data/Rakefile +20 -0
- data/lib/fileboost/url_builder.rb +14 -4
- data/lib/fileboost/variant_transformer.rb +130 -0
- data/lib/fileboost/version.rb +1 -1
- data/lib/fileboost.rb +1 -0
- data/lib/generators/fileboost/templates/INSTALL.md +13 -22
- metadata +36 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd68355a3cdd26c34422cd082cb8795b10e609a8edbda257982974173a338170
|
4
|
+
data.tar.gz: 9f29b3da4b48d17b58bb2f70565e383ad184758269b8ba51245fb99ebeaa53f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50349d3d91cc8e16b077654a290320cc61d5588f8d070a2b9dab5a91cb2201b55b011ea675e2c1485276db30b12e5a89252d5454911d1e5b5ea3695ea56b8801
|
7
|
+
data.tar.gz: 6ec42cf3b8ef2c80b8fb2b24908c83b219056016f1a1cbf588c9cb9dfed96ed2965cf37a99c108343fb38bb79776b6bf903347802e31a2212ef8a214c040093d
|
data/README.md
CHANGED
@@ -4,13 +4,46 @@
|
|
4
4
|
|
5
5
|
Fileboost is a Rails gem that provides seamless integration with the Fileboost.dev image optimization service. It offers drop-in replacement helpers for Rails' native image helpers with automatic optimization, HMAC authentication, and comprehensive transformation support for ActiveStorage objects.
|
6
6
|
|
7
|
+
## Table of Contents
|
8
|
+
|
9
|
+
- [Features](#features)
|
10
|
+
- [Requirements](#requirements)
|
11
|
+
- [Installation](#installation)
|
12
|
+
- [Configuration](#configuration)
|
13
|
+
- [Usage](#usage)
|
14
|
+
- [Drop-in Replacement (Recommended)](#drop-in-replacement-recommended)
|
15
|
+
- [Manual Helper Method](#manual-helper-method)
|
16
|
+
- [URL Generation](#url-generation)
|
17
|
+
- [Transformation Options](#transformation-options)
|
18
|
+
- [Parameter Aliases](#parameter-aliases)
|
19
|
+
- [ActiveStorage Support](#activestorage-support)
|
20
|
+
- [ActiveStorage Variants (NEW in v0.2.0)](#activestorage-variants-new-in-v020)
|
21
|
+
- [Variant Transformation Mapping](#variant-transformation-mapping)
|
22
|
+
- [Combining Variants with Custom Options](#combining-variants-with-custom-options)
|
23
|
+
- [Responsive Images](#responsive-images)
|
24
|
+
- [Error Handling](#error-handling)
|
25
|
+
- [Security](#security)
|
26
|
+
- [Development](#development)
|
27
|
+
- [Testing](#testing)
|
28
|
+
- [Contributing](#contributing)
|
29
|
+
- [License](#license)
|
30
|
+
- [Support](#support)
|
31
|
+
|
7
32
|
## Features
|
8
33
|
|
9
|
-
- 🚀 **Drop-in replacement** for Rails `image_tag`
|
34
|
+
- 🚀 **Drop-in replacement** for Rails `image_tag` with zero code changes (NEW in v0.2.0)
|
35
|
+
- 🎨 **Full ActiveStorage Variant support** with automatic transformation mapping (NEW in v0.2.0)
|
10
36
|
- 🔒 **Secure HMAC authentication** with Fileboost.dev service
|
11
37
|
- 📱 **ActiveStorage only** - works exclusively with ActiveStorage attachments
|
12
38
|
- 🎛️ **Comprehensive transformations** - resize, quality, format conversion, and more
|
13
39
|
- 🔧 **Simple configuration** - just project ID and token required
|
40
|
+
- 🔄 **Automatic fallback** - non-ActiveStorage images work exactly as before
|
41
|
+
|
42
|
+
## Requirements
|
43
|
+
|
44
|
+
- Ruby 3.0+
|
45
|
+
- Rails 7.1+
|
46
|
+
- ActiveStorage
|
14
47
|
|
15
48
|
## Installation
|
16
49
|
|
@@ -43,11 +76,59 @@ export FILEBOOST_PROJECT_ID="your-project-id"
|
|
43
76
|
export FILEBOOST_TOKEN="your-secret-token"
|
44
77
|
```
|
45
78
|
|
79
|
+
Or configure directly in your initializer:
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
# config/initializers/fileboost.rb
|
83
|
+
Fileboost.configure do |config|
|
84
|
+
config.project_id = ENV["FILEBOOST_PROJECT_ID"]
|
85
|
+
config.token = ENV["FILEBOOST_TOKEN"]
|
86
|
+
|
87
|
+
# Optional: Enable drop-in replacement for Rails image_tag (default: false)
|
88
|
+
config.patch_image_tag = true
|
89
|
+
end
|
90
|
+
```
|
91
|
+
|
46
92
|
## Usage
|
47
93
|
|
48
|
-
###
|
94
|
+
### Drop-in Replacement (Recommended)
|
49
95
|
|
50
|
-
|
96
|
+
Enable `patch_image_tag` in your configuration to automatically optimize ActiveStorage images with your existing `image_tag` calls:
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
# config/initializers/fileboost.rb
|
100
|
+
Fileboost.configure do |config|
|
101
|
+
config.project_id = ENV["FILEBOOST_PROJECT_ID"]
|
102
|
+
config.token = ENV["FILEBOOST_TOKEN"]
|
103
|
+
config.patch_image_tag = true # Enable automatic optimization
|
104
|
+
end
|
105
|
+
```
|
106
|
+
|
107
|
+
With this enabled, your existing Rails code automatically gets Fileboost optimization:
|
108
|
+
|
109
|
+
```erb
|
110
|
+
<!-- This now automatically uses Fileboost for ActiveStorage objects -->
|
111
|
+
<%= image_tag user.avatar, resize: { w: 300, h: 300 }, alt: "Avatar" %>
|
112
|
+
<%= image_tag post.featured_image, resize: { width: 800, quality: 85 }, class: "hero" %>
|
113
|
+
|
114
|
+
<!-- ActiveStorage variants work seamlessly -->
|
115
|
+
<%= image_tag user.avatar.variant(resize_to_limit: [100, 100]), alt: "Thumbnail" %>
|
116
|
+
<%= image_tag post.image.variant(:thumb), alt: "Post thumbnail" %>
|
117
|
+
|
118
|
+
<!-- Non-ActiveStorage images work exactly as before -->
|
119
|
+
<%= image_tag "/assets/logo.png", alt: "Logo" %>
|
120
|
+
<%= image_tag "https://example.com/image.jpg", alt: "External" %>
|
121
|
+
```
|
122
|
+
|
123
|
+
**Benefits:**
|
124
|
+
- Zero code changes required for existing ActiveStorage images
|
125
|
+
- Full ActiveStorage variant support with automatic transformation mapping
|
126
|
+
- Automatic fallback to Rails behavior for non-ActiveStorage assets
|
127
|
+
- Gradual migration path - enable/disable with single configuration option
|
128
|
+
|
129
|
+
### Manual Helper Method
|
130
|
+
|
131
|
+
Alternatively, use `fileboost_image_tag` explicitly for ActiveStorage objects:
|
51
132
|
|
52
133
|
```erb
|
53
134
|
<!-- Before (Rails) -->
|
@@ -104,7 +185,7 @@ fileboost_image_tag(image, resize: { w: 400, h: 300, q: 85 })
|
|
104
185
|
fileboost_image_tag(image, resize: { width: 400, height: 300, quality: 85 })
|
105
186
|
```
|
106
187
|
|
107
|
-
|
188
|
+
**🎯 Smart Optimization:** Fileboost's CDN automatically detects and delivers the optimal image format (WebP, AVIF, JPEG, etc.) based on browser capabilities, device type, and connection speed for maximum performance.
|
108
189
|
|
109
190
|
### ActiveStorage Support
|
110
191
|
|
@@ -123,6 +204,63 @@ Works seamlessly with all ActiveStorage attachment types:
|
|
123
204
|
<%= fileboost_image_tag post.featured_image.blob, resize: { w: 800 } %>
|
124
205
|
```
|
125
206
|
|
207
|
+
### ActiveStorage Variants (NEW in v0.2.0)
|
208
|
+
|
209
|
+
Fileboost now provides full support for ActiveStorage variants with automatic transformation mapping:
|
210
|
+
|
211
|
+
```erb
|
212
|
+
<!-- Basic variants with automatic transformation mapping -->
|
213
|
+
<%= image_tag user.avatar.variant(resize_to_limit: [200, 200]) %>
|
214
|
+
<!-- ↓ Automatically becomes: w=200&h=200&fit=scale-down -->
|
215
|
+
|
216
|
+
<%= image_tag post.image.variant(resize_to_fit: [400, 300]) %>
|
217
|
+
<!-- ↓ Automatically becomes: w=400&h=300&fit=contain -->
|
218
|
+
|
219
|
+
<%= image_tag hero.banner.variant(resize_to_fill: [800, 400]) %>
|
220
|
+
<!-- ↓ Automatically becomes: w=800&h=400&fit=cover -->
|
221
|
+
|
222
|
+
<!-- Complex variants with multiple transformations -->
|
223
|
+
<%= image_tag post.image.variant(
|
224
|
+
resize_to_limit: [600, 400],
|
225
|
+
quality: 85
|
226
|
+
) %>
|
227
|
+
<!-- ↓ Automatically becomes: w=600&h=400&fit=scale-down&q=85 -->
|
228
|
+
|
229
|
+
<!-- Named variants work seamlessly -->
|
230
|
+
<%= image_tag user.avatar.variant(:thumb) %>
|
231
|
+
<!-- ↓ Uses predefined variant transformations -->
|
232
|
+
```
|
233
|
+
|
234
|
+
#### Variant Transformation Mapping
|
235
|
+
|
236
|
+
Fileboost automatically maps ActiveStorage variant transformations to optimized URL parameters:
|
237
|
+
|
238
|
+
| ActiveStorage Variant | Fileboost Parameters | Description |
|
239
|
+
|----------------------|---------------------|-------------|
|
240
|
+
| `resize_to_limit: [w, h]` | `w=W&h=H&fit=scale-down` | Resize within bounds, preserving aspect ratio |
|
241
|
+
| `resize_to_fit: [w, h]` | `w=W&h=H&fit=contain` | Resize to fit exactly, with letterboxing if needed |
|
242
|
+
| `resize_to_fill: [w, h]` | `w=W&h=H&fit=cover` | Resize and crop to fill exactly |
|
243
|
+
| `resize_and_pad: [w, h]` | `w=W&h=H&fit=pad` | Resize with padding |
|
244
|
+
| `quality: 85` | `q=85` | JPEG/WebP quality (1-100) |
|
245
|
+
| `rotate: "-90"` | `r=-90` | Rotation in degrees |
|
246
|
+
|
247
|
+
|
248
|
+
#### Combining Variants with Custom Options
|
249
|
+
|
250
|
+
You can combine variant transformations with additional Fileboost options:
|
251
|
+
|
252
|
+
```erb
|
253
|
+
<!-- Variant transformations + additional options -->
|
254
|
+
<%= image_tag user.avatar.variant(resize_to_limit: [200, 200]),
|
255
|
+
resize: { blur: 5, brightness: 110 } %>
|
256
|
+
<!-- ↓ Combines variant params with additional blur and brightness -->
|
257
|
+
|
258
|
+
<!-- Override variant parameters -->
|
259
|
+
<%= image_tag post.image.variant(resize_to_limit: [400, 300]),
|
260
|
+
resize: { w: 500 } %>
|
261
|
+
<!-- ↓ Uses h=300&fit=scale-down from variant, but overrides width to 500 -->
|
262
|
+
```
|
263
|
+
|
126
264
|
### Responsive Images
|
127
265
|
|
128
266
|
Generate multiple sizes for responsive designs:
|
@@ -171,7 +309,7 @@ After checking out the repo, run:
|
|
171
309
|
|
172
310
|
```bash
|
173
311
|
$ bundle install
|
174
|
-
$
|
312
|
+
$ bundle exec rspec
|
175
313
|
```
|
176
314
|
|
177
315
|
To test against the dummy Rails application:
|
@@ -186,7 +324,7 @@ $ rails server
|
|
186
324
|
Run the test suite:
|
187
325
|
|
188
326
|
```bash
|
189
|
-
$
|
327
|
+
$ bundle exec rspec
|
190
328
|
```
|
191
329
|
|
192
330
|
Run RuboCop:
|
@@ -211,5 +349,5 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
211
349
|
|
212
350
|
## Support
|
213
351
|
|
214
|
-
- [GitHub Issues](https://github.com/
|
215
|
-
- [Documentation](https://github.com/
|
352
|
+
- [GitHub Issues](https://github.com/Fileboost/fileboost-ruby/issues)
|
353
|
+
- [Documentation](https://github.com/Fileboost/fileboost-ruby/wiki)
|
data/Rakefile
CHANGED
@@ -2,6 +2,26 @@ require "bundler/setup"
|
|
2
2
|
require "bundler/gem_tasks"
|
3
3
|
require "rspec/core/rake_task"
|
4
4
|
|
5
|
+
begin
|
6
|
+
require "appraisal"
|
7
|
+
rescue LoadError
|
8
|
+
# Appraisal not available
|
9
|
+
end
|
10
|
+
|
5
11
|
RSpec::Core::RakeTask.new(:spec)
|
6
12
|
|
7
13
|
task default: :spec
|
14
|
+
|
15
|
+
namespace :test do
|
16
|
+
desc "Run tests against all Rails versions"
|
17
|
+
task :all do
|
18
|
+
sh "bundle exec appraisal install"
|
19
|
+
sh "bundle exec appraisal rspec"
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Run tests against specific Rails version (e.g. rake test:rails[7-1])"
|
23
|
+
task :rails, [ :version ] do |t, args|
|
24
|
+
version = args[:version] || "7-2"
|
25
|
+
sh "bundle exec appraisal rails-#{version} rspec"
|
26
|
+
end
|
27
|
+
end
|
@@ -43,7 +43,7 @@ module Fileboost
|
|
43
43
|
full_path = "/#{project_id}#{asset_path}"
|
44
44
|
|
45
45
|
# Extract and normalize transformation parameters
|
46
|
-
transformation_params = extract_transformation_params(options)
|
46
|
+
transformation_params = extract_transformation_params(asset, options)
|
47
47
|
|
48
48
|
# Generate HMAC signature for secure authentication
|
49
49
|
signature = Fileboost::SignatureGenerator.generate(
|
@@ -89,10 +89,16 @@ module Fileboost
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
-
def self.extract_transformation_params(options)
|
92
|
+
def self.extract_transformation_params(asset, options)
|
93
93
|
params = {}
|
94
94
|
|
95
|
-
#
|
95
|
+
# First, extract variant transformations if this is a variant
|
96
|
+
if asset.is_a?(ActiveStorage::VariantWithRecord)
|
97
|
+
variant_params = Fileboost::VariantTransformer.transform_variant_params(asset)
|
98
|
+
params.merge!(variant_params)
|
99
|
+
end
|
100
|
+
|
101
|
+
# Then handle explicit resize parameter (this can override variant params)
|
96
102
|
if options[:resize].is_a?(Hash)
|
97
103
|
resize_options = options[:resize]
|
98
104
|
resize_options.each do |key, value|
|
@@ -117,9 +123,13 @@ module Fileboost
|
|
117
123
|
|
118
124
|
def self.normalize_param_value(key, value)
|
119
125
|
case key
|
120
|
-
when "w", "h", "
|
126
|
+
when "w", "h", "b", "br", "c", "r"
|
121
127
|
# Numeric parameters
|
122
128
|
value.to_i.to_s if value.to_i > 0
|
129
|
+
when "q"
|
130
|
+
# Quality parameter - validate range 1-100
|
131
|
+
q = value.to_i
|
132
|
+
(q > 0 && q <= 100) ? q.to_s : nil
|
123
133
|
when "f"
|
124
134
|
# Format parameter - validate against common formats
|
125
135
|
valid_formats = %w[webp jpeg jpg png gif avif]
|
@@ -0,0 +1,130 @@
|
|
1
|
+
module Fileboost
|
2
|
+
# Maps ActiveStorage variant transformations to Fileboost URL parameters
|
3
|
+
class VariantTransformer
|
4
|
+
# Maps ActiveStorage transformation operations to Fileboost parameters
|
5
|
+
TRANSFORMATION_MAPPING = {
|
6
|
+
# Resize operations
|
7
|
+
resize_to_limit: { fit: "scale-down" },
|
8
|
+
resize_to_fit: { fit: "contain" },
|
9
|
+
resize_to_fill: { fit: "cover" },
|
10
|
+
resize_and_pad: { fit: "pad" },
|
11
|
+
|
12
|
+
# Quality settings
|
13
|
+
quality: { param: "q" },
|
14
|
+
|
15
|
+
# Format settings
|
16
|
+
format: { param: "f" },
|
17
|
+
|
18
|
+
# Rotation
|
19
|
+
rotate: { param: "r" },
|
20
|
+
|
21
|
+
# Crop operations - need special handling
|
22
|
+
crop: { special: :crop_handler }
|
23
|
+
}.freeze
|
24
|
+
|
25
|
+
# Convert ActiveStorage variant transformations to Fileboost parameters
|
26
|
+
def self.transform_variant_params(variant)
|
27
|
+
return {} unless variant.respond_to?(:variation)
|
28
|
+
|
29
|
+
transformations = variant.variation.transformations
|
30
|
+
params = {}
|
31
|
+
|
32
|
+
transformations.each do |operation, value|
|
33
|
+
case operation
|
34
|
+
when :resize_to_limit, :resize_to_fit, :resize_to_fill, :resize_and_pad
|
35
|
+
resize_params = handle_resize_operation(operation, value)
|
36
|
+
params.merge!(resize_params)
|
37
|
+
|
38
|
+
when :quality
|
39
|
+
params["q"] = normalize_quality(value)
|
40
|
+
|
41
|
+
when :format
|
42
|
+
params["f"] = normalize_format(value)
|
43
|
+
|
44
|
+
when :rotate
|
45
|
+
params["r"] = normalize_rotation(value)
|
46
|
+
|
47
|
+
when :crop
|
48
|
+
crop_params = handle_crop_operation(value)
|
49
|
+
params.merge!(crop_params) if crop_params
|
50
|
+
|
51
|
+
# Add more transformations as needed
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
params
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
# Handle resize operations (resize_to_limit, resize_to_fit, etc.)
|
61
|
+
def self.handle_resize_operation(operation, dimensions)
|
62
|
+
return {} unless dimensions.is_a?(Array) && dimensions.length >= 2
|
63
|
+
|
64
|
+
width, height = dimensions[0], dimensions[1]
|
65
|
+
params = {}
|
66
|
+
|
67
|
+
# Set dimensions
|
68
|
+
params["w"] = width.to_s if width && width > 0
|
69
|
+
params["h"] = height.to_s if height && height > 0
|
70
|
+
|
71
|
+
# Set fit parameter based on resize operation
|
72
|
+
fit_mapping = TRANSFORMATION_MAPPING[operation]
|
73
|
+
params["fit"] = fit_mapping[:fit] if fit_mapping && fit_mapping[:fit]
|
74
|
+
|
75
|
+
params
|
76
|
+
end
|
77
|
+
|
78
|
+
# Handle crop operations
|
79
|
+
def self.handle_crop_operation(crop_params)
|
80
|
+
# Crop can be in different formats depending on the processor
|
81
|
+
# For now, we'll handle simple array format: [x, y, width, height]
|
82
|
+
if crop_params.is_a?(Array) && crop_params.length == 4
|
83
|
+
x, y, w, h = crop_params
|
84
|
+
return { "crop" => "#{x},#{y},#{w},#{h}" }
|
85
|
+
end
|
86
|
+
|
87
|
+
# Could extend this for other crop formats
|
88
|
+
nil
|
89
|
+
end
|
90
|
+
|
91
|
+
# Normalize quality value (0-100)
|
92
|
+
def self.normalize_quality(quality)
|
93
|
+
q = quality.to_i
|
94
|
+
return nil if q <= 0 || q > 100
|
95
|
+
q.to_s
|
96
|
+
end
|
97
|
+
|
98
|
+
# Normalize format value
|
99
|
+
def self.normalize_format(format)
|
100
|
+
# Convert to string and lowercase
|
101
|
+
format_str = format.to_s.downcase
|
102
|
+
|
103
|
+
# Map common format variations
|
104
|
+
case format_str
|
105
|
+
when "jpg", "jpeg"
|
106
|
+
"jpg"
|
107
|
+
when "png"
|
108
|
+
"png"
|
109
|
+
when "webp"
|
110
|
+
"webp"
|
111
|
+
when "avif"
|
112
|
+
"avif"
|
113
|
+
when "gif"
|
114
|
+
"gif"
|
115
|
+
else
|
116
|
+
# If it's already a recognized format, use it
|
117
|
+
valid_formats = %w[webp jpeg jpg png gif avif]
|
118
|
+
valid_formats.include?(format_str) ? format_str : nil
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
# Normalize rotation value
|
123
|
+
def self.normalize_rotation(rotation)
|
124
|
+
# Rotation should be a number (degrees)
|
125
|
+
r = rotation.to_s.gsub(/[^\d\-]/, "") # Remove non-numeric chars except minus
|
126
|
+
return nil if r.empty?
|
127
|
+
r
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
data/lib/fileboost/version.rb
CHANGED
data/lib/fileboost.rb
CHANGED
@@ -2,6 +2,7 @@ require "fileboost/version"
|
|
2
2
|
require "fileboost/config"
|
3
3
|
require "fileboost/error_handler"
|
4
4
|
require "fileboost/signature_generator"
|
5
|
+
require "fileboost/variant_transformer"
|
5
6
|
require "fileboost/url_builder"
|
6
7
|
require "fileboost/helpers"
|
7
8
|
require "fileboost/image_tag_patch"
|
@@ -9,33 +9,24 @@ config/initializers/fileboost.rb
|
|
9
9
|
|
10
10
|
Next steps:
|
11
11
|
|
12
|
-
1.
|
12
|
+
1. Register an account at: https://fileboost.dev
|
13
|
+
Get your project ID and secret token
|
14
|
+
|
15
|
+
2. Set your environment variables:
|
13
16
|
export FILEBOOST_PROJECT_ID="your-project-id"
|
14
17
|
export FILEBOOST_TOKEN="your-secret-token"
|
15
18
|
|
16
|
-
|
17
|
-
Edit config/initializers/fileboost.rb
|
18
|
-
|
19
|
-
3. Start using Fileboost helpers in your views:
|
20
|
-
|
21
|
-
<!-- Replace image_tag with fileboost_image_tag -->
|
22
|
-
|
23
|
-
<%= fileboost_image_tag user.avatar, alt: "Avatar", resize: {width: 100, height: 100, fit: "cover"} %>
|
24
|
-
|
25
|
-
<!-- Generate optimized URLs -->
|
19
|
+
3. Enable drop-in replacement (recommended):
|
20
|
+
Edit config/initializers/fileboost.rb and set:
|
21
|
+
config.patch_image_tag = true
|
26
22
|
|
27
|
-
|
23
|
+
4. Your existing image_tag calls now work with ActiveStorage images:
|
24
|
+
<%= image_tag user.avatar %>
|
25
|
+
<%= image_tag post.image.variant(resize_to_limit: [300, 200]) %>
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
- quality (or q): 1-100
|
32
|
-
- format (or f): webp, jpeg, png, gif, avif
|
33
|
-
- blur (or b): 0-100
|
34
|
-
- brightness (or br): 0-200
|
35
|
-
- contrast (or c): 0-200
|
36
|
-
- rotation (or r): 0-359
|
37
|
-
- fit: cover, contain, fill, scale-down, crop, pad
|
27
|
+
5. Or use explicit helpers:
|
28
|
+
<%= fileboost_image_tag user.avatar, resize: {w: 300, h: 200, fit: "cover"} %>
|
38
29
|
|
39
|
-
For
|
30
|
+
For documentation, visit: https://github.com/Fileboost/fileboost-ruby
|
40
31
|
|
41
32
|
===============================================================================
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fileboost
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0.
|
4
|
+
version: 0.2.0.pre3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- bilal
|
7
|
+
- bilal budhani
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
@@ -15,28 +15,48 @@ dependencies:
|
|
15
15
|
requirements:
|
16
16
|
- - ">="
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: '
|
18
|
+
version: '7'
|
19
19
|
type: :runtime
|
20
20
|
prerelease: false
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
23
|
- - ">="
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: '
|
25
|
+
version: '7'
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
|
-
name:
|
27
|
+
name: appraisal
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
30
|
- - "~>"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '2'
|
32
|
+
version: '2.5'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '2'
|
39
|
+
version: '2.5'
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: bundler
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '2.1'
|
47
|
+
- - "<"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '2.7'
|
50
|
+
type: :development
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '2.1'
|
57
|
+
- - "<"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '2.7'
|
40
60
|
- !ruby/object:Gem::Dependency
|
41
61
|
name: combustion
|
42
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -69,16 +89,16 @@ dependencies:
|
|
69
89
|
name: rails
|
70
90
|
requirement: !ruby/object:Gem::Requirement
|
71
91
|
requirements:
|
72
|
-
- - "
|
92
|
+
- - ">="
|
73
93
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
94
|
+
version: '7'
|
75
95
|
type: :development
|
76
96
|
prerelease: false
|
77
97
|
version_requirements: !ruby/object:Gem::Requirement
|
78
98
|
requirements:
|
79
|
-
- - "
|
99
|
+
- - ">="
|
80
100
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
101
|
+
version: '7'
|
82
102
|
- !ruby/object:Gem::Dependency
|
83
103
|
name: rspec
|
84
104
|
requirement: !ruby/object:Gem::Requirement
|
@@ -141,17 +161,18 @@ files:
|
|
141
161
|
- lib/fileboost/image_tag_patch.rb
|
142
162
|
- lib/fileboost/signature_generator.rb
|
143
163
|
- lib/fileboost/url_builder.rb
|
164
|
+
- lib/fileboost/variant_transformer.rb
|
144
165
|
- lib/fileboost/version.rb
|
145
166
|
- lib/generators/fileboost/install_generator.rb
|
146
167
|
- lib/generators/fileboost/templates/INSTALL.md
|
147
168
|
- lib/generators/fileboost/templates/fileboost.rb
|
148
|
-
homepage: https://github.com/
|
169
|
+
homepage: https://github.com/Fileboost/fileboost-ruby
|
149
170
|
licenses:
|
150
171
|
- MIT
|
151
172
|
metadata:
|
152
|
-
homepage_uri: https://github.com/
|
153
|
-
source_code_uri: https://github.com/
|
154
|
-
changelog_uri: https://github.com/
|
173
|
+
homepage_uri: https://github.com/Fileboost/fileboost-ruby
|
174
|
+
source_code_uri: https://github.com/Fileboost/fileboost-ruby
|
175
|
+
changelog_uri: https://github.com/Fileboost/fileboost-ruby/blob/main/CHANGELOG.md
|
155
176
|
rdoc_options: []
|
156
177
|
require_paths:
|
157
178
|
- lib
|