Adds automatic Blurhash encoding for images in Payload upload collections. Registered through the plugins array, it stores a compact placeholder hash for each image. It can use either the blurhash or thumbhash algorithm, and separate package versions exist for Payload v2 and v3.
Payload CMS plugin for automatic Blurhash encoding of images
Installation
npm i payload-blurhash-plugin94
Stars
7
Forks
7
Open Issues
1 years ago
Last Updated
0
Weekly Downloads
v3.1.0
npm Version
94.4 KB
Unpacked Size
3
Dependencies
Trends appear after 7 days of data. Daily snapshots have not started yet.
Trends appear after 7 days of data. Daily snapshots have not started yet.
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/497083627-root)<a href="https://payloaddirectory.dev/plugins/497083627-root"><img src="https://payloaddirectory.dev/badge/497083627-root.svg" alt="Payload Directory"></a>README
Payload CMS plugin for automatic Blurhash encoding of images.
npm i payload-blurhash-plugin@2npm i payload-blurhash-plugin@3payload.config.ts:import computeBlurhash from 'payload-blurhash-plugin';
export default buildConfig({
/* ... */
plugins: [computeBlurhash()],
});
Optionally, you can pass the following options to tweak the behavior of the plugin:
export type BlurhashPluginOptions = {
/*
* 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'][];
/*
* Pattern to determine which MIME types to target
* Default: image/*
*/
mimeTypePattern?: string;
/*
* Whether to show the Blurhash field when viewing media items in the admin interface.
* Default: false
*/
showBlurhashField?: boolean;
} & AlgorithmOptions;
The AlgorithmOptions depend on which algorithm you are using. Currently, there
are two algorithms available: "blurhash" (the default) and "thumbhash". You can
select an algorithm by specifying the algorithm name under the algorithm key.
These are the options for the "blurhash" algorithm:
type BlurhashOptions = {
// Default: 32
width?: number | undefined;
// Default: 32
height?: number | undefined;
// Default: 3
componentX?: number | undefined;
// Default: 3
componentY?: number | undefined;
};
There are currently no options for the "thumbhash" algorithm.
The defaults are chosen somewhat arbitrarily, they are just values that I've found to work nicely for me.
image search
Search and import images from Unsplash, Pexels and Pixabay without leaving the Payload admin
78533/wk114v3
payload plugin aspect preview
Crop and focal point editing with live multi-aspect-ratio previews for Payload upload collections
7534/wk6v3
blur data urls
Generates blur placeholder data URLs for images uploaded to Payload media collections
6966/wk83v3
payload media
Search Unsplash, Pexels and Pixabay stock images and videos from Payload upload collections
680/wk8v4
images
On-demand Sharp image transforms with focal points, built-in blur placeholders and a favicons collection
570/wk37v3
payload icons
SVG icon upload collection with automatic optimization and a server component to render icons inline
560/wk18v3