EMINENT Logo
Software

Offload WordPress Media to a DigitalOcean Spaces Bucket

Author

Zayadur

Date Published

Decorative image from DigitalOcean's Spaces Object Storage landing page.

WordPress Spaces is a plugin designed to offload media uploads from your WordPress site to DigitalOcean Spaces, providing efficient media management and storage solutions. This plugin supports synchronization of media files, both uploading to and downloading from DigitalOcean Spaces, and offers a range of configuration options to suit your needs.

View Source

Current State of Affairs

WordPress websites that host a large number of media assets often face significant challenges related to performance and storage. As the volume of images, videos, and other files increases, the site can become bloated, leading to slower loading times and a degraded user experience. This bloat can strain server resources, complicating tasks like backups and organization. Current solutions to these issues can be prohibitively expensive, often requiring ongoing subscription fees that feel unjustified given the minimal operational overhead involved—primarily limited to updates and bug fixes. This creates a sense of extortion for website owners, who may feel pressured to pay for services that do not provide adequate value, ultimately hindering their ability to maintain optimal performance and deliver a smooth experience for visitors.

Why WordPress Spaces

In light of these challenges, WordPress Spaces offers a cost-effective solution for offloading media files to DigitalOcean Spaces, helping to streamline media management and enhance website performance. By addressing the issues of bloated storage and high costs associated with existing solutions, it provides seamless synchronization and customizable storage options. This empowers WordPress users to maintain optimal site performance without the financial burden of traditional services, ensuring a smoother experience for their visitors.

1. Automatic Upload: Automatically uploads media files to DigitalOcean Spaces upon upload.

2. Batch Synchronization: Supports batch processing of large media libraries with progress tracking.

3. Reverse Synchronization: Allows users to download media files back to the local WordPress library.

4. Customizable Storage Paths: Enables subfolder storage within Spaces.

5. CDN Integration: Option to integrate a CDN URL for media files.

6. User-Friendly Admin Interface: Provides a settings page for configuration and synchronization controls.

Plugin Structure

Core Functionality: Located in the core directory, including initialization and AWS client setup.

Admin Interface: Managed in the admin directory, including settings and actions.

Synchronization: Handled in the sync directory, with separate files for sync and reverse sync processes.

Utilities: Helper functions and logging are in the utils directory.

Installation

1. Upload the wp-spaces directory to the /wp-content/plugins/ directory.

2. Activate the plugin through the Plugins menu in WordPress.

3. Navigate to Settings > WordPress Spaces to configure your DigitalOcean Spaces credentials and settings.

Configuration

DigitalOcean Spaces Settings

Access Key: Input your DigitalOcean Spaces access key for secure authentication.

Secret Key: Enter your DigitalOcean Spaces secret key for secure authentication.

Space Name: Specify the name of your DigitalOcean Space.

Region: Identify the geographical location of your Space.

CDN URL: Optionally enter a CDN URL for serving media files more efficiently.

Subfolder Mode: Enable the option to store files in a specific subfolder within the Space for better organization.

Controls

Enable Sync: Start syncing files to DigitalOcean Spaces. This checks and initiates a forward migration.

Disable Sync: Stop synchronization and initiate a reverse migration of files back to WordPress.

Cancel Sync: Cancel any ongoing synchronization operations and flip the migration state.

Usage

Uploading Media

When media files are uploaded to WordPress, they are automatically transferred to DigitalOcean Spaces if synchronization is enabled. The local copy is deleted after a successful upload.

Forward Migration

The plugin handles synchronization in batches, processing a set number of files at a time. Progress is tracked and displayed in the admin interface.

Reverse Migration

If you choose to disable synchronization, the plugin can reverse sync files back to the local WordPress library, ensuring all media files are available locally.