Preview Images
Automatic generation of resized preview images at configured aspect ratios for product assets.
Omnium can automatically generate preview images at different sizes when product assets are uploaded. This feature creates optimized images for thumbnails, galleries, and other display contexts.
How It Works
When IsImagesAutoResizedOnUpload is enabled, Omnium generates preview images for each configured aspect ratio:
Processing Flow
- Asset is uploaded to blob storage
- If auto-resize is enabled and aspect ratios are configured:
- For each aspect ratio, a preview is generated
- Preview is stored alongside the original
- Previews are created lazily (on-demand) or during upload
Configuration
Enable Auto-Resize
Configure Aspect Ratios
Define the sizes to generate:
Preview File Naming
Preview files follow a consistent naming pattern:
By Height
When only height is specified:
By Width
When width is specified:
Examples
| Original | Preview Size | Preview Filename |
|---|---|---|
front.jpg | 150px height | front__preview_150.jpg |
front.jpg | 600px height | front__preview_600.jpg |
front.jpg | 300px width | front__preview_w300.jpg |
Storage Location
Preview images are stored in the same container and virtual folder as the original:
Supported Formats
Preview generation supports common image formats:
| Format | Supported | Notes |
|---|---|---|
| JPEG | Yes | Most common, good compression |
| PNG | Yes | Supports transparency |
| GIF | Yes | Animated GIFs not resized |
| WebP | Yes | Modern format, good compression |
| SVG | No | Vector format, returned as-is |
SVG images are vector-based and don't need resizing. When an SVG is requested, the original URL is returned without preview generation.
On-Demand Generation
Previews can also be generated on-demand when requested:
Request a Preview
Behavior
- Check if preview already exists
- If exists and valid (size > 0), return the preview URL
- If not exists, generate from original:
- Download original image
- Resize to target dimensions
- Upload preview to storage
- Return preview URL
Caching
Generated previews are stored permanently. Subsequent requests return the existing preview without regeneration.
Aspect Ratio Properties
| Property | Type | Description |
|---|---|---|
Name | string | Identifier (used in filename) |
TranslateKey | string | UI translation key |
IsDefault | bool | Mark as default size |
Width | int | Target width in pixels |
Height | int | Target height in pixels |
Sizing Behavior
- If only
Heightis specified: Image is scaled proportionally to fit height - If only
Widthis specified: Image is scaled proportionally to fit width - If both are specified: Image is scaled to fit within the bounding box
Common Size Configurations
E-commerce Standard
Responsive Images
Preview Cleanup
When assets are deleted, associated preview images are also removed:
- Find all preview images matching the original filename pattern
- Delete each preview from storage
- Delete the original image
Pattern Matching
Previews are found using regex pattern:
Performance Considerations
Generation Time
- Preview generation adds processing time during upload
- For large catalogs, consider generating previews asynchronously
- First-time on-demand generation may be slow
Storage
- Each aspect ratio adds storage for every image
- Storage cost = (Number of images) × (Number of ratios + 1)
- Consider your actual size needs before adding many ratios
Best Practices
- Limit aspect ratios: Only configure sizes you actually need
- Use appropriate dimensions: Don't generate 4K previews for thumbnails
- Consider CDN: Use CDN for preview delivery to reduce latency
Changing ImageAspectRatios after assets have been uploaded will not regenerate existing previews. New previews will only be created for newly uploaded assets or when on-demand generation is triggered.
Troubleshooting
Previews Not Generated
| Issue | Cause | Solution |
|---|---|---|
| No previews created | IsImagesAutoResizedOnUpload is false | Enable in tenant settings |
| No previews created | ImageAspectRatios is empty | Configure aspect ratios |
| Format not supported | Unsupported image format | Convert to supported format |
Invalid Previews
| Issue | Cause | Solution |
|---|---|---|
| Empty preview files | Image processing error | Re-upload original asset |
| Corrupted previews | Source image corrupted | Verify original image quality |
| Wrong dimensions | Configuration changed | Delete and regenerate previews |
