Media Asset Structure
Assets are defined with comprehensive metadata (types.ts:318-329):
Accessing the Media Library
Uploading Media
Supported File Types
- Images
- Videos
- Documents
- Audio
Formats: JPEG, PNG, GIF, WebP, SVGMax Size: 10MB per fileRecommended: WebP for photos (best compression)Use Cases: Featured images, blog photos, page graphics
Upload Process
Media Management UI
The Media Library UI is implemented inAdminViews.tsx with these views:
Grid View
Visual thumbnail grid showing:- Asset thumbnails
- File type icons
- Asset names
- Quick action buttons (view, edit, delete)
List View
Detailed table showing:- Filename
- Type
- Size
- Dimensions (for images/videos)
- Upload date
- Tags
- Actions
View Toggle
Switch between views using icons in the toolbar:Organizing Media
Folder System
Create folders to organize assets by project or type:Recommended Folder Structure
Tagging System
Tags enable cross-folder searching and filtering:Best Practices for Tags
- Use lowercase for consistency
- Include broad categories:
meditation,retreat,community - Add specific descriptors:
hero-image,thumbnail,icon - Use location tags:
santiago,online,argentina - Include year for dated content:
2024
Example Tag Sets
Blog Featured Image:Searching and Filtering
The Media Library supports advanced search (storage.ts:419-424):
Search Operators
| Operator | Example | Result |
|---|---|---|
| Basic | meditation | Matches filename or tags |
| Type filter | type:image | Only images |
| Tag filter | tag:hero | Only assets with βheroβ tag |
| Date filter | date:2024 | Uploaded in 2024 |
Image Optimization
Recommended Sizes
| Use Case | Dimensions | Format | Max Size |
|---|---|---|---|
| Hero backgrounds | 1920x1080px | WebP/JPEG | 300KB |
| Featured images | 1200x630px | WebP/JPEG | 200KB |
| Blog thumbnails | 600x400px | WebP/JPEG | 100KB |
| Icons | 512x512px | PNG/SVG | 50KB |
| Logos | Variable | SVG/PNG | 30KB |
Optimization Tools
- TinyPNG/TinyJPG: Compress without quality loss
- Squoosh: Googleβs web-based optimizer
- ImageOptim: Mac desktop app
- GIMP/Photoshop: Manual optimization
Managing Assets
Editing Asset Metadata
Deleting Assets
Deletion is handled by (
storage.ts:413-418):
Bulk Operations
Select multiple assets to:- Add tags: Apply tags to all selected
- Move to folder: Bulk organize
- Delete: Remove multiple assets
- Download: Get a zip of selected files
Using Assets in Content
In Pages Editor
When adding an Image section:- Click βSelect from Media Libraryβ
- Browse or search for the asset
- Click to insert the URL automatically
In Blog Posts
For featured images:- In the image URL field, click the media icon
- Select an image from the library
- The URL populates automatically
In Custom Code
Reference assets by their URL:Storage and Performance
Media assets are stored with this configuration (storage.ts:400-425):
| Storage Key | Content |
|---|---|
cafh_media_v1 | Array of MediaAsset objects |
Storage Considerations
- localStorage limit: ~10MB total for all data
- Asset URLs: Typically stored as base64 or external URLs
- Large files: Should be hosted externally (CDN)
- Performance: Keep total assets under 500 for optimal loading
For production sites with extensive media needs, integrate with a CDN like Cloudinary or AWS S3.
Media Library Maintenance
Regular Tasks
Monthly Audit
Monthly Audit
- Remove unused assets
- Check for duplicate files
- Verify all links still work
- Update tags for better organization
Quarterly Review
Quarterly Review
- Archive old event images
- Optimize large files
- Reorganize folder structure
- Document naming conventions
Annual Cleanup
Annual Cleanup
- Delete deprecated assets
- Migrate to CDN if needed
- Review and update metadata
- Export backup of all media
Access Control
Media Library access is role-based:| Role | Permissions |
|---|---|
| SUPER_ADMIN | Full access: upload, edit, delete |
| ADMIN | Upload, edit own uploads, view all |
| EDITOR | Upload, edit own uploads |
| MEMBER | View public assets only |
| GUEST | No access |
Role management is covered in the User Role Management documentation.
Best Practices
File Naming
β Good Names:hero-meditation-room-2024.jpgretreat-poster-santiago-march.pdfpodcast-episode-12-spirituality.mp3
IMG_1234.jpguntitled.pdfrecording.mp3
Alt Text
Always include descriptive alt text for images:Copyright
- Only upload media you own or have permission to use
- Store license info in asset description
- Credit photographers/creators when required
- Use royalty-free stock for generic images
Troubleshooting
Upload Fails
- Check file size: Must be under type-specific limit
- Verify format: Use supported file types
- Clear cache: Browser cache may cause issues
- Check quota: localStorage may be full
Broken Image Links
- Verify URL: Check that the asset still exists
- Check permissions: Asset may be private
- Update references: If moved to CDN, update URLs
Slow Loading
- Optimize images: Compress to WebP format
- Use CDN: Move large files to external hosting
- Lazy load: Implement lazy loading for galleries
- Reduce size: Resize images to needed dimensions
Related Documentation
CMS Overview
Complete content management system
Pages Editor
Using media in custom pages
Blog Management
Adding images to blog posts