WP Manifestindependent plugin directory
manifest / media / wp-gcs-media-plugin

WP GCS Media

This is a wordpress plugin in php. It is used to store/sync wordpress media files from gcs cloud storage bucket

by Aravind · github.com/aravindbalasundaram/wp-gcs-media-plugin

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/aravindbalasundaram/wp-gcs-media-plugin/archive/refs/heads/main.zip

A WordPress plugin written in PHP to store, sync, and serve media files (images, videos, documents, etc.) from a Google Cloud Storage (GCS) bucket instead of the local WordPress uploads directory.

This helps reduce server storage usage, improve media delivery performance, and centralize file storage on Google Cloud.


🚀 Features

  • Automatically uploads WordPress media files to Google Cloud Storage.
  • Syncs existing WordPress media library with GCS.
  • Serves media directly from GCS public URLs or via a custom CDN domain.
  • Supports all WordPress media types (images, videos, PDFs, etc.).
  • Works seamlessly with the WordPress Media Library.
  • Simple admin settings page for configuration.

📦 Installation

1. Manual Upload

  1. Download or clone this repository:

    git clone https://github.com/aravindbalasundaram/wp-gcs-media-plugin.git

  2. Copy the folder wp-gcs-media-plugin into your WordPress wp-content/plugins/ directory.

  3. Activate the plugin from WordPress Admin → Plugins.

2. Zip Install (Optional)

  1. Zip the folder:

cd wp-gcs-media-plugin zip -r wp-gcs-media-plugin.zip .

  1. Go to WordPress Admin → Plugins → Add New → Upload Plugin.

  2. Upload the wp-gcs-media-plugin.zip file and activate.

====

⚙️ Configuration

  1. Create a Google Cloud Storage (GCS) Bucket
  • Go to the Google Cloud Console
  • Create a new bucket (or use an existing one).
  • Make sure the bucket has the correct permissions for read/write access.
  1. Create a Service Account & Key
  • In Google Cloud Console, go to IAM & Admin → Service Accounts.
  • Create a new service account with the role:
    • Storage Object Admin
    • Storage Object Viewer
  • Generate a JSON key file and download it.
  • Place this file inside your WordPress server, e.g.: /var/www/html/wp-content/gcs-key.json
  1. Configure Plugin Settings

In your wp-config.php, define the following:

define('GCS_BUCKET', 'your-gcs-bucket-name'); define('GCS_KEY_FILE', DIR . '/gcs-key.json'); // Service Account JSON define('GCS_PROXY_DOMAIN', 'https://your-proxy-domain.com'); // Change to your proxy domain

If you don’t provide CGM_PROXY_DOMAIN, files will be served from the default GCS bucket URL.

📂 How It Works

  1. When you upload a file via WordPress Media Library:

    • The file is uploaded to GCS.
    • The local file can optionally be deleted (to save server space).
    • The WordPress attachment URL points to the GCS public URL.
  2. When accessing the media file:

    • WordPress rewrites the URL to point to your GCS bucket or CDN domain.

🔧 Usage

  1. Upload media as usual via Media → Add New in WordPress.

  2. Uploaded files will automatically sync to Google Cloud Storage.

  3. Access files directly from:


✅ Requirements

PHP 7.4+ (recommended 8.x)

WordPress 5.0+

Google Cloud Project with a valid service account & GCS bucket

google/cloud-storage PHP SDK (installed via composer)

Install dependencies (if not bundled):

bash command : composer require google/cloud-storage