Base64 image placeholder
Generates a base64-encoded placeholder image for Payload upload collections and stores it in a text field.
Installation
pnpm add payload-base64-plugin About
This plugin adds a `base64` text field to Payload upload collections and populates it automatically when a file is uploaded. On each `beforeChange` hook it reads the incoming file and runs it through the `plaiceholder` library (which uses sharp) to produce a small, blurred base64 data URL. The result is stored on the document, so frontends can render an instant low-quality placeholder while the full image loads. It is a fork of the `payload-blurhash-plugin`, with the encoding swapped from blurhash strings to base64. By default it attaches to every collection that has an `upload` config. You can restrict it to specific slugs via the `collections` option. Three options are exposed: `collections` to target specific upload collections, `size` (an integer from 4 to 64, default 4) controlling the placeholder dimensions, and `removeAlpha` (default true) to strip the alpha channel. It targets Payload 1.x and requires sharp as a peer dependency. One limitation: it processes one upload field per collection and writes a single `base64` field, so it is not suited to collections needing multiple placeholders per document. The admin webpack config is patched to alias the package to a mock during bundling, which keeps the server-only sharp dependency out of the admin bundle.
Package info
- Package name
payload-base64-plugin- Latest version
1.2.0- Unpacked size
- 13 kB
- License
- Unlicense
- Weekly downloads
- 112
- Last publish
- Nov 27, 2022
Similar plugins
More in FieldsMenus
Adds a menus collection to Payload for building navigation with nested items, collection links, custom URLs, icons, and preview images.
Icon Picker
Adds an icon picker field plugin for Payload CMS with search and SVG support.
Barcodes
Adds Code 128, EAN-13 and QR code generation to Payload product collections with a printable label page and optional admin print buttons.
Shipping Classes
Adds weight, dimensions, and shipping class fields to Payload products and variants, storing values canonically in grams and millimetres for cart totalling.
Downloads
Sells digital products from a Payload store using signed, expiring download links that stop working when an order is refunded.
Order Numbers
Assigns every Payload ecommerce order a short, readable, concurrency-safe number like ORD-01042 via a reservations collection.