Overview
The Dental Odontogram application uses Cloudinary as the image storage service for odontogram PNG files. Cloudinary provides reliable, scalable cloud-based image management with CDN delivery.Environment Variables
To integrate Cloudinary, you need to configure the following environment variables:Your Cloudinary cloud name (found in your Cloudinary dashboard)
Your Cloudinary API key for authentication
Your Cloudinary API secret for secure authentication
Setting Up Environment Variables
Create a.env.local file in your project root:
Configuration
The Cloudinary SDK is configured in the upload endpoint with the following settings:Configuration Options
- cloud_name - Identifies your Cloudinary account
- api_key - Public key for API authentication
- api_secret - Private key for secure authentication
- secure - When set to
true, uses HTTPS for all uploads and URLs
How Images Are Uploaded
The upload process uses Cloudinary’s upload stream API with custom options:Upload Options Explained
Specifies the type of file being uploaded
Forces the output format to PNG
Automatically optimizes quality while maintaining visual fidelity
Unique identifier for the image:
odontograms/{recordId}_{timestamp}Organizes images into the ‘odontograms’ folder in Cloudinary
Metadata attached to the image:
patient_record- Airtable record IDupload_date- ISO timestamporiginal_name- Original filename
Upload Result
After a successful upload, Cloudinary returns an object containing:secure_url is stored in Airtable as the image reference.
Getting Your Cloudinary Credentials
- Sign up for a free Cloudinary account at cloudinary.com
- Navigate to Dashboard - After logging in, you’ll see your credentials
- Copy credentials:
- Cloud Name
- API Key
- API Secret
- Add to environment variables as shown above
Free Tier Limits
Cloudinary’s free tier includes:- 25 GB storage
- 25 GB monthly bandwidth
- 25,000 monthly transformations
Error Handling
The application validates Cloudinary credentials before attempting uploads:Security Best Practices
- Never expose API secrets in client-side code
- Use environment variables for all credentials
- Enable secure URLs with
secure: true - Rotate credentials periodically
- Monitor usage in Cloudinary dashboard to detect unusual activity
Image Organization
All odontogram images are stored in theodontograms/ folder with the naming convention:
- Easy identification of patient records
- No naming conflicts
- Chronological ordering of uploads
Next Steps
- Learn how data is stored in Airtable Integration
- Explore the Upload API Endpoint documentation