leonardstruck

payload base64 plugin

by leonardstruck
Media & images
v1
^1.0.11
Unlicense

Overview

Summary generated from the README

Adds automatic base64 encoding of uploaded images in Payload upload collections, producing small placeholder data. It is registered in the plugins array of the Payload config and applies to all upload collections by default. Options let you limit it to specific collections, set the placeholder size between 4 and 64, and toggle alpha channel removal. It targets Payload 1.x.

Features

  • Automatic base64 encoding of uploaded images
  • Applies to all upload collections by default
  • Collection slug filter to limit where it runs
  • Configurable placeholder size from 4 to 64
  • Optional alpha channel removal

Use cases

  • Show blurred low-quality placeholders while full images load on the frontend
  • Store lightweight inline image previews alongside upload documents

From the author

Payload CMS plugin for automatic base64 encoding of images

Installation

npm i payload-base64-plugin

17

Stars

3

Forks

2

Open Issues

3 years ago

Last Updated

59

Weekly Downloads

v1.2.0

npm Version

13.2 KB

Unpacked Size

1

Dependencies

GitHub stars

170 since Sep 6

Show data
GitHub stars by day (UTC)
DateStars
Dec 5, 202617
Dec 4, 202617
Dec 3, 202617
Dec 2, 202617
Dec 1, 202617
Nov 30, 202617
Nov 29, 202617
Nov 28, 202617
Nov 27, 202617
Nov 26, 202617
Nov 25, 202617
Nov 24, 202617
Nov 23, 202617
Nov 22, 202617
Nov 21, 202617
Nov 20, 202617
Nov 19, 202617
Nov 18, 202617
Nov 17, 202617
Nov 16, 202617
Nov 15, 202617
Nov 14, 202617
Nov 13, 202617
Nov 12, 202617
Nov 11, 202617
Nov 10, 202617
Nov 9, 202617
Nov 8, 202617
Nov 7, 202617
Nov 6, 202617
Nov 5, 202617
Nov 4, 202617
Nov 3, 202617
Nov 2, 202617
Nov 1, 202617
Oct 31, 202617
Oct 30, 202617
Oct 29, 202617
Oct 28, 202617
Oct 27, 202617
Oct 26, 202617
Oct 25, 202617
Oct 24, 202617
Oct 23, 202617
Oct 22, 202617
Oct 21, 202617
Oct 20, 202617
Oct 19, 202617
Oct 18, 202617
Oct 17, 202617
Oct 16, 202617
Oct 15, 202617
Oct 14, 202617
Oct 13, 202617
Oct 12, 202617
Oct 11, 202617
Oct 10, 202617
Oct 9, 202617
Oct 8, 202617
Oct 7, 202617
Oct 6, 202617
Oct 5, 202617
Oct 4, 202617
Oct 3, 202617
Oct 2, 202617
Oct 1, 202617
Sep 30, 202617
Sep 29, 202617
Sep 28, 202617
Sep 27, 202617
Sep 26, 202617
Sep 25, 202617
Sep 24, 202617
Sep 23, 202617
Sep 22, 202617
Sep 21, 202617
Sep 20, 202617
Sep 19, 202617
Sep 18, 202617
Sep 17, 202617
Sep 16, 202617
Sep 15, 202617
Sep 14, 202617
Sep 13, 202617
Sep 12, 202617
Sep 11, 202617
Sep 10, 202617
Sep 9, 202617
Sep 8, 202617
Sep 7, 202617
Sep 6, 202617
npm weekly downloads

34−28 since Sep 6

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 5, 202634
Dec 4, 202631
Dec 3, 202651
Dec 2, 202649
Dec 1, 202649
Nov 30, 202648
Nov 29, 202655
Nov 28, 202678
Nov 27, 202678
Nov 26, 202673
Nov 25, 202670
Nov 24, 202666
Nov 23, 202666
Nov 22, 202671
Nov 21, 202660
Nov 20, 202653
Nov 19, 202647
Nov 18, 202651
Nov 17, 202651
Nov 16, 202653
Nov 15, 202649
Nov 14, 202650
Nov 13, 202656
Nov 12, 202655
Nov 11, 202650
Nov 10, 202650
Nov 9, 202648
Nov 8, 202649
Nov 7, 202644
Nov 6, 202639
Nov 5, 202631
Nov 4, 202628
Nov 3, 202628
Nov 2, 202630
Nov 1, 202620
Oct 31, 202632
Oct 30, 202656
Oct 29, 202652
Oct 28, 202650
Oct 27, 202650
Oct 26, 202649
Oct 25, 202650
Oct 24, 202636
Oct 23, 20269
Oct 22, 202621
Oct 21, 202627
Oct 20, 202627
Oct 19, 202626
Oct 18, 202630
Oct 17, 202639
Oct 16, 202645
Oct 15, 202645
Oct 14, 202645
Oct 13, 202645
Oct 12, 202650
Oct 11, 202651
Oct 10, 202658
Oct 9, 202677
Oct 8, 202695
Oct 7, 2026109
Oct 6, 2026109
Oct 5, 2026104
Oct 4, 2026107
Oct 3, 2026117
Oct 2, 2026112
Oct 1, 202690
Sep 30, 202680
Sep 29, 202683
Sep 28, 202683
Sep 27, 2026111
Sep 26, 202689
Sep 25, 202673
Sep 24, 202667
Sep 23, 202661
Sep 22, 202664
Sep 21, 202665
Sep 20, 202690
Sep 19, 2026102
Sep 18, 2026108
Sep 17, 2026115
Sep 16, 2026112
Sep 15, 2026106
Sep 14, 2026107
Sep 13, 202650
Sep 12, 202649
Sep 11, 202651
Sep 10, 202649
Sep 9, 202653
Sep 8, 202653
Sep 7, 202652
Sep 6, 202662

Each point is npm's rolling 7-day download count.

Health Score

39/100Fair

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/571626986-root.svg)](https://payloaddirectory.dev/plugins/571626986-root)
HTML
<a href="https://payloaddirectory.dev/plugins/571626986-root"><img src="https://payloaddirectory.dev/badge/571626986-root.svg" alt="Payload Directory"></a>
Updated Jan 21, 2023Created Nov 28, 2022Published Nov 27, 2022

README

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!

Similar plugins