Overview
The system converts PNG medication images to WebP format and uploads them to Supabase Storage, then links them to the medications table.How It Works
- Place PNG files in the expected directory with correct naming
- Run the upload script
- Script converts PNG to WebP (80% quality)
- Uploads to
medication-imagesbucket in Supabase Storage - Updates medication records with image URLs
File Naming
Files must follow this pattern:Concerta-XL-18.png→ Concerta XL 18mgElvvanse-20.png→ Elvvanse 20mgMedikinet-XL-10.png→ Medikinet XL 10mg
Setup
Environment Variables
Dependencies
Images Directory
Place PNG files in:Running the Script
Expected Output
Database Changes
The script adds animage_url column to the medications table:
Storage Configuration
- Bucket:
medication-images(public access) - Format: WebP at 80% quality
- Size limit: 1MB per file
- MIME type:
image/webp
Troubleshooting
Missing Service Role Key
.env file
Directory Not Found
IMAGES_DIR in script or move images to expected location
Medication Not Found
Upload Failures
Manual Verification
After running the script:Frontend Usage
Images are accessed via theimage_url field in medication records: