Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Custom image names

default discord avatar
westhills.9 months ago
1

I'm trying to customize the filenames of the images to use the srcset based on the width of images.



This looks a good solution but it's not working on Payload 2.26.0. Is this only for version 3?




generateImageName: ({ height, sizeName, extension, width }) => { return

custom-${sizeName}-${height}-${width}.${extension}

},

Object literal may only specify known properties, and 'generateImageName' does not exist in type 'ImageSize'.



I’ve created a custom function that do this for Payload 2. I can post the code if someone is interested

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.