ImageKit
Website: imagekit.io
ImageKit is a cloud-based image optimization and CDN service used for all file uploads (photos, documents, videos) in Sutomo.
Overview
All uploaded files pass through ImageKit for:
- CDN delivery — fast global distribution
- Automatic optimization — WebP conversion, compression, resizing
- URL-based transformations — resize/crop on the fly via URL parameters
- Private file support — signed URLs for sensitive documents
Integration
Flow
- User uploads a file →
Assetmodel saves withuploadedFileproperty AssetObservertriggers → callsImageKitService- Service prepares (compress, resize, convert to WebP) then uploads to ImageKit
- ImageKit returns a CDN URL → stored in
assets.path - All subsequent access uses the CDN URL
Environment Variables
env
IMAGEKIT_PUBLIC_KEY=your_public_key
IMAGEKIT_PRIVATE_KEY=your_private_key
IMAGEKIT_URL_ENDPOINT=https://ik.imagekit.io/your_accountDevelopment Credentials
Shared ImageKit account for local development (owned by the team). Use these in your local .env so everyone works against the same dev CDN.
| Variable | Value |
|---|---|
IMAGEKIT_PUBLIC_KEY | public_JbmUC2vzh0wfdHxU5SgujPPIke0= |
IMAGEKIT_PRIVATE_KEY | private_bJCqmAqNI5iGaRtDFODSfTZXCIc= |
IMAGEKIT_URL_ENDPOINT | https://ik.imagekit.io/o2epoyqvj/ |
Sign in at imagekit.io with:
- Email:
dev@icanntechindo.com- Password:
Dev_test@2026
⚠️ These are development credentials only — never use them in production. Production keys live in the deployment environment, not in
.env.
URL Transformations
ImageKit supports on-the-fly transformations via URL parameters:
php
// Original: https://ik.imagekit.io/sutomo/schools/photos/student_abc.jpg
// Resize to 200x200
// https://ik.imagekit.io/sutomo/schools/photos/student_abc.jpg?tr=w-200,h-200
// Crop to square
// https://ik.imagekit.io/sutomo/schools/photos/student_abc.jpg?tr=w-200,h-200,cm-pad_resize
// WebP format
// https://ik.imagekit.io/sutomo/schools/photos/student_abc.jpg?tr=f-webpKey Files
| File | Purpose |
|---|---|
app/Services/Asset/ImageKitService.php | Upload orchestration — prepare, upload, option resolution |
app/Services/Asset/CompressService.php | Iterative image compression |
app/Services/Asset/ResizeService.php | Image resizing/scaling |
app/Services/Asset/ConversionService.php | WebP conversion |
app/Observers/Platform/AssetObserver.php | Auto-trigger upload on Asset save |
.env | IMAGEKIT_* credentials |