Skip to content

Commit 5970ed0

Browse files
committed
docs: add format (f) examples to resize docs and warn against forcing format for browser-facing images
1 parent 214ab2b commit 5970ed0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ Fileboost supports comprehensive image transformations:
161161
width: 800, # Resize width
162162
height: 600, # Resize height
163163
quality: 85, # JPEG/WebP quality (1-100)
164+
format: "jpg", # Force specific format (jpg, png, webp, avif)
164165
blur: 5, # Blur effect (0-100)
165166
brightness: 110, # Brightness adjustment (0-200, 100 = normal)
166167
contrast: 120, # Contrast adjustment (0-200, 100 = normal)
@@ -172,7 +173,7 @@ Fileboost supports comprehensive image transformations:
172173
173174
<!-- Short parameter names also work -->
174175
<%= fileboost_image_tag post.image,
175-
resize: { w: 800, h: 600, q: 85 },
176+
resize: { w: 800, h: 600, q: 85, f: "jpg" },
176177
class: "hero-image" %>
177178
```
178179

@@ -182,12 +183,14 @@ Use short or long parameter names within the resize parameter:
182183

183184
```ruby
184185
# These are equivalent:
185-
fileboost_image_tag(image, resize: { w: 400, h: 300, q: 85 })
186-
fileboost_image_tag(image, resize: { width: 400, height: 300, quality: 85 })
186+
fileboost_image_tag(image, resize: { w: 400, h: 300, q: 85, f: "jpg" })
187+
fileboost_image_tag(image, resize: { width: 400, height: 300, quality: 85, format: "jpg" })
187188
```
188189

189190
**🎯 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.
190191

192+
**⚠️ Format Parameter Usage:** The `format` parameter should only be used in non-browser-facing scenarios (API responses, webhooks, server-to-server communication, etc.). For browser-facing images, omit the format parameter to allow Fileboost to automatically serve the best format for each user's browser and connection.
193+
191194
### ActiveStorage Support
192195

193196
Works seamlessly with all ActiveStorage attachment types:

0 commit comments

Comments
 (0)