|
|
|
|
Built-in tools to diagnose and fix common cloud storage issues — no manual database edits needed.
|
Scans all offloaded files via HEAD requests. Files returning 403 AccessDenied or other errors are listed with a one-click fix that sets Offload Media > Fix Permissions |
Finds offloaded images where thumbnail sizes are missing from the cloud. Common after bulk offload interruptions or when WordPress generates new image sizes. Uploads missing thumbnails and stores their cloud URLs. Offload Media > Fix Thumbnails |
Detects when your CDN URL, bucket, or region settings changed but stored media URLs still point to the old location. Bulk-updates all URLs to match current settings — no re-uploading needed. Offload Media > Fix URLs |
Each tool follows a Scan → Review → Fix workflow with real-time progress tracking, batch processing, and detailed error reporting.
| Requirement | Minimum |
|---|---|
| WordPress | 5.0+ |
| PHP | 7.2+ |
| Cloud Account | S3, Spaces, or GCS |
No Composer or external libraries needed. Uses WordPress's built-in HTTP API with AWS Signature V4 request signing.
# Clone the repo
git clone https://github.com/gunjanjaswal/offload-media-to-cloud.git
# Copy to your WordPress plugins directory
cp -r offload-media-to-cloud /path/to/wp-content/plugins/Or via WordPress admin:
- Plugins > Add New > Upload Plugin
- Upload the ZIP file
- Activate
- Go to Offload Media > Settings
| Field | Example |
|---|---|
| Access Key ID | AKIAIOSFODNN7EXAMPLE |
| Secret Access Key | wJalrXUtnFEMI/K7MDENG/... |
| Bucket Name | my-media-bucket |
| Region | us-east-1 |
| Field | Example |
|---|---|
| Access Key | DO00XXXXXXXXXXXXXXXXXX |
| Secret Key | your-secret-key |
| Space Name | my-space |
| Region | nyc3, sfo3, sgp1 |
| Field | Example |
|---|---|
| HMAC Access Key | GOOGXXXXXXXXXXXXXXXXX |
| HMAC Secret Key | your-hmac-secret |
| Bucket Name | my-gcs-bucket |
Create HMAC keys in: GCS Console > Cloud Storage > Settings > Interoperability
| Setting | Description |
|---|---|
| 🌐 CDN URL | CloudFront, DO CDN, or custom domain for faster delivery |
| 📁 Path Prefix | Organize files in cloud folders (e.g. wp-uploads) |
| 🗑️ Remove Local Files | Auto-delete from server after successful cloud upload |
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ WordPress │ │ Plugin │ │ Cloud │
│ Upload │────▶│ Auto Sync │────▶│ Storage │
│ │ │ │ │ (S3/DO/GCS) │
└──────────────┘ └──────────────┘ └──────────────┘
│
▼
┌──────────────┐
│ URL Rewrite │
│ ─────────── │
│ Post Content │
│ Srcset URLs │
│ Thumbnails │
│ Theme/Header │
│ CDN Delivery │
└──────────────┘
- Upload — Media uploaded to WordPress as usual
- Sync — Plugin automatically copies to cloud storage
- Rewrite — All URLs rewritten to cloud/CDN endpoints
- Serve — Images delivered from cloud, not your server
- (Optional) Cleanup — Local files removed to save disk space
| Page | Description |
|---|---|
| Settings | Configure provider, credentials, CDN, path prefix, local file removal |
| Bulk Offload | Migrate entire media library to cloud with progress tracking & auto-retry |
| Restore Local | Download cloud files back to server before deactivating |
| Fix Permissions | Scan for 403/404 errors and set public-read ACL |
| Fix Thumbnails | Find & upload missing thumbnail sizes to cloud |
| Fix URLs | Update stale URLs after CDN/bucket/region config changes |
offload-media-to-cloud/
│
├── 📄 offload-media-to-cloud.php ← Plugin entry point
│
├── 📁 includes/
│ ├── 🔧 class-offload-media-to-cloud.php ← Core orchestrator
│ ├── ⚙️ class-settings.php ← Settings & AJAX handlers
│ ├── ☁️ class-uploader.php ← Auto-sync new uploads
│ ├── 📦 class-bulk-offload.php ← Bulk migration
│ ├── ⬇️ class-bulk-restore.php ← Bulk restore
│ ├── 🔐 class-fix-permissions.php ← Scan & fix ACL
│ ├── 🖼️ class-fix-thumbnails.php ← Fix missing thumbs
│ ├── 🔗 class-fix-urls.php ← Fix URL mismatches
│ ├── 🔏 class-s3-signing.php ← AWS Sig V4 signing
│ ├── ✅ class-dependency-checker.php ← PHP requirements
│ │
│ ├── 📁 providers/
│ │ ├── 🏗️ class-provider-base.php ← Abstract base
│ │ ├── 🟠 class-s3-provider.php ← Amazon S3
│ │ ├── 🔵 class-spaces-provider.php ← DigitalOcean Spaces
│ │ └── 🔴 class-gcs-provider.php ← Google Cloud Storage
│ │
│ └── 📁 views/
│ ├── 🖥️ settings.php ← Settings page UI
│ ├── 📦 bulk-offload.php ← Bulk offload UI
│ ├── ⬇️ bulk-restore.php ← Bulk restore UI
│ ├── 🔐 fix-permissions.php ← Fix permissions UI
│ ├── 🖼️ fix-thumbnails.php ← Fix thumbnails UI
│ └── 🔗 fix-urls.php ← Fix URLs UI
│
├── 📁 assets/
│ ├── 🎨 css/admin.css ← Modern admin styles
│ └── ⚡ js/admin.js ← Admin functionality
│
├── 📄 readme.txt ← WordPress.org readme
└── 📄 README.md ← You are here
- All credentials stored securely in WordPress database
- Data transmitted over HTTPS only
- AWS Signature V4 request signing — credentials never sent in plain text
- AJAX endpoints protected with WordPress nonce verification
- Capability checks (
manage_options) on all admin actions - Input sanitization on all user inputs
| Supported | |
|---|---|
| Page Builders | Elementor, Beaver Builder, Divi, WPBakery, Gutenberg, Oxygen |
| E-commerce | WooCommerce product images, galleries, downloadable products |
| Multisite | Full multisite support with per-site configuration |
| CDNs | CloudFront, BunnyCDN, KeyCDN, DigitalOcean CDN, custom domains |
| Provider | Storage | Transfer |
|---|---|---|
| Amazon S3 | ~$0.023/GB/month | ~$0.09/GB |
| DigitalOcean Spaces | $5/month for 250GB | 1TB included |
| Google Cloud Storage | ~$0.020/GB/month | ~$0.12/GB |
Most small to medium WordPress sites pay less than $5–10/month.
This project is licensed under the GPLv2 or later — see the LICENSE for details.