The gallery feature allows users to upload and manage media files (images, videos, documents) for their sites. It uses Cloudinary for file storage and optimization.
- ✅ Image Upload - Support for JPG, PNG, GIF, WebP
- ✅ Video Upload - Support for MP4, AVI, MOV, WMV, FLV, WebM
- ✅ Document Upload - Support for PDF, DOC, DOCX, TXT, ZIP, RAR
- ✅ Drag & Drop - Easy file upload interface
- ✅ Metadata Support - Alt text, descriptions, tags
- ✅ Search & Filter - Find files quickly
- ✅ Grid/List Views - Flexible display options
- ✅ Copy URLs - Easy sharing of media files
- ✅ Tenant Isolation - Each user sees only their files
- Go to cloudinary.com
- Sign up for a free account
- Get your credentials from the dashboard
Add these to your .env file:
CLOUDINARY_CLOUD_NAME="your-cloud-name"
CLOUDINARY_API_KEY="your-api-key"
CLOUDINARY_API_SECRET="your-api-secret"The gallery automatically:
- Organizes files by tenant subdomain
- Optimizes images (max 1920x1080, auto quality)
- Supports multiple file formats
- Provides secure URLs
- Navigate to Media Gallery in the admin panel
- Click Upload Media button
- Drag & drop files or click to browse
- Add metadata (alt text, description, tags)
- Click Upload to process files
The gallery includes:
- Database Schema - Media table with tenant relationships
- API Routes - Upload, fetch, delete endpoints
- React Components - Uploader, grid, manager
- TypeScript Types - Full type safety
- Maximum Size: 50MB per file
- Image Formats: JPG, JPEG, PNG, GIF, WebP
- Video Formats: MP4, AVI, MOV, WMV, FLV, WebM
- Document Formats: PDF, DOC, DOCX, TXT, ZIP, RAR
- 🔄 Video Processing - Thumbnail generation, format conversion
- 🔄 Image Editing - Crop, resize, filters
- 🔄 Bulk Operations - Select multiple files
- 🔄 Advanced Search - Search by tags, date, size
- 🔄 CDN Integration - Faster global delivery
- 🔄 File Versioning - Keep multiple versions
Fetch all media items for the current user's tenant
Upload a new media file with metadata
Delete a specific media item
CREATE TABLE media (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
url TEXT NOT NULL,
type TEXT NOT NULL,
size INTEGER NOT NULL,
width INTEGER,
height INTEGER,
duration INTEGER,
alt TEXT,
description TEXT,
tags TEXT,
tenantId TEXT NOT NULL,
uploadedBy TEXT NOT NULL,
createdAt TIMESTAMP DEFAULT NOW(),
updatedAt TIMESTAMP DEFAULT NOW()
);