This chapter describes file and media management in the Folio Rails Engine, focusing on best practices and generator-based workflows for file placements, custom file types, and media handling.
Folio provides a robust system for managing files and media assets, including images, videos, documents, and more. File placements allow you to associate files with pages, atoms (CMS blocks), or other models, supporting flexible content structures.
- File Placements:
- Allow files to be attached to pages, atoms, or other models
- Support single or multiple file associations
- Metadata:
- Folio extracts and stores metadata for each file (e.g., image dimensions, video duration)
- Metadata can be used for display, filtering, or processing
- Media Types:
- Images, videos, audio, documents, and other file types are supported
- Custom file types can be added
- Keep file associations clear and well-documented
- Leverage metadata for advanced features (e.g., responsive images, previews)
- Use the admin console for file management whenever possible
Manual editing of file or placement models is only recommended for advanced use cases.
Single placement
= simple_form_for @page do |f|
= file_picker_for_cover(f)Multiple placement
= simple_form_for @page do |f|
= react_images f.object.image_placements,
attachmentable: 'folio_page',
type: :image_placementsFolio supports automatic subtitle generation for video files using AI transcription services. Subtitles are stored in VTT format and can be manually edited in the admin console.
Supported subtitle languages:
- Configured via
config.folio_files_video_enabled_subtitle_languages(default[%w[cs]]) - Site-specific languages can be configured via
Folio::Site#subtitle_languages
Automatic subtitle generation:
Folio supports two transcription providers:
-
ElevenLabs Speech-to-Text (recommended, used in production)
- Automatic language detection
- Supports files up to 1.5 GB
- Uses cloud storage URLs for processing
- Returns SRT format, converted to VTT
-
OpenAI Whisper (alternative, not currently used in production)
- Requires explicit language specification
- Compresses audio to optimize costs
- Direct file upload
Configuration:
To enable automatic subtitle generation, configure the transcription job in your application:
# In app/models/folio/file/video.rb or app/overrides/models/folio/file/video_override.rb
module Folio::File::Video
class_methods do
def transcribe_subtitles_job_class
Folio::ElevenLabs::TranscribeSubtitlesJob # Recommended: used in production
# Folio::OpenAi::TranscribeSubtitlesJob # Alternative: not currently used
end
end
endEnvironment variables:
For ElevenLabs (recommended):
ELEVENLABS_API_KEY- Your ElevenLabs API key
For OpenAI (alternative, not used in production):
OPENAI_API_KEY- Your OpenAI API key
How it works:
- When a video is uploaded and
site.subtitle_auto_generation_enabledistrue, transcription starts automatically - The job sends the video URL to the transcription service
- ElevenLabs automatically detects the language (with probability score)
- The detected language is matched against site's enabled subtitle languages
- If probability > 50% and language is enabled, subtitles are generated in that language
- Otherwise, fallback to default language (
Folio::VideoSubtitle.default_language) - Subtitles are converted to VTT format and stored in
Folio::VideoSubtitlemodel - Subtitles can be manually edited or regenerated in the admin console
File size limits:
- ElevenLabs: Maximum 1.5 GB (1536 MB)
- Files exceeding the limit will show an error message
Subtitle states:
pending- Not yet generatedprocessing- Transcription in progressready- Subtitles generated and enabledprocessing_failed- Transcription failed (error message stored)
Manual subtitle management:
Subtitles can be manually uploaded, edited, or regenerated via the admin console at /console/file/videos/:id.
Folio can automatically extract full EXIF & IPTC metadata from uploaded images when exiftool is available on the server.
Installation:
• Install on macOS: brew install exiftool
• Install on Ubuntu: sudo apt install exiftool
How it works:
- Uses
multi_exiftoolgem via Dragonfly analyser - Metadata extracted automatically on image upload (
after_assigncallback) - All metadata stored as JSON in
file_metadatadatabase column - Available helper methods:
title,caption,keywords,geo_location
Fill missing metadata: rake folio:file:fill_missing_metadata
📋 See full Image Metadata Extraction feature specification →
- ← Back to Overview
- ← Back to Atoms (CMS Blocks)
- ← Back to Admin Console
- Next: Forms →
- Extending & Customization
For more details, see the individual chapters linked above. This files & media overview will be updated as the documentation evolves.