payload-base64-plugin
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

payload-blurhash-plugin

Payload CMS plugin for automatic base64 encoding of images.

Getting started

  1. Install the package with npm i payload-base64-plugin or yarn add payload-base64-plugin.
  2. Add the plugin to your payload.config.ts:
import generateBase64 from 'payload-blurhash-plugin';

export default buildConfig({
  /* ... */
  plugins: [generateBase64()],
});

Plugin options

Optionally, you can pass the following options to tweak the behavior of the plugin:

export interface Base64PluginOptions {
  /*
   * Array of collection slugs that the plugin should apply to.
   * By default, the plugin will apply to all collections with `upload` properties.
   */
  collections?: CollectionConfig['slug'][];

  /*
   * an integer (between 4 and 64) to adjust the returned placeholder size
   * Default: 4
   */
  size?: number;

  /*
   * turn on/off the alpha channel removal
   * Default: true
   */
  removeAlpha?: boolean;
}

Credits

This plugin is heavily based on the plugin payload-blurhash-plugin by invakid404.

Since I only changed the encoding to base64, I decided to fork the original plugin instead of creating a new one.

Thank you a lot for your work!

Readme

Keywords

none

Package Sidebar

Install

npm i payload-base64-plugin

Weekly Downloads

7

Version

1.2.0

License

Unlicense

Unpacked Size

13.5 kB

Total Files

9

Last publish

Collaborators

  • leonard.struck