kodansha/wack-cloudinary

Uploads the uploaded media files to Cloudinary

Installs: 36

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:wordpress-plugin

v0.0.2 2024-02-09 11:33 UTC

This package is not auto-updated.

Last update: 2024-05-17 12:41:28 UTC


README

WACK Cloudinary is a WordPress plugin to upload the media files to Cloudinary.

It hooks into the WordPress wp_handle_upload and when a media file is uploaded, it also uploads the file to Cloudinary.

It is created with the intention of being used with the WACK Stack, but it can also be used with other WordPress installations.

Important

This plugin does NOT replaces neither the media URLs in the content nor the URLs in the media library. This means you have to manually replace the URLs when displaying the media to users.

Installation

  • Requires PHP 8.1 or later
  • Requires WordPress 6.0 or later
  • Requires Composer

Using Composer

composer require kodansha/wack-cloudinary

Note

This plugin is not available on the WordPress.org plugin repository. For the moment, the only way to install it is to use Composer.

How to use

Pre-requisites

You need to set up the Cloudinary account and set the credentials in the environment variables.

export CLOUDINARY_URL=cloudinary://<api_key>:<api_secret>@<cloud_name>

Tip

It strongly recommended to use the .env file to set the environment variables, especially in the local development environment.

Configuration

You might want to define settings through the WACK_CLOUDINARY_SETTINGS constant:

define('WACK_CLOUDINARY_SETTINGS', [
    // Optional: The type of the Cloudinary media access. Possible values are 'authenticated', 'upload', 'private'
    // Default: 'upload'
    'type' => 'private',

    // Optional: The Cloudinary root folder to upload the media files.
    // Default: none
    'root_folder' => 'my-root-folder',

    // Optional: The notification URL endpoint to receive the Cloudinary notifications.
    // Default: none
    'notification_url' => 'https://example.com/cloudinary-notification',

    // Optional: The username and password for the basic authentication.
    // If your WordPress is behind the basic authentication, you need to set this to work the async requests.
    // Default: none
    'basic_auth' => [
        'username' => 'example-user',
        'password' => 'example-password',
    ]
]);

Upload media files

After setting the above pre-requisites and configuration, when you upload a media file to the WordPres, the file is also uploaded to Cloudinary.

TODO

  • Support video upload
  • Support eager transformation
  • Support upload presets