Change the generated filename for resized media?

default discord avatar
reepicheep05
last month
2

I am working on setting up a CDN for my media uploads and have set up the uploads collection with various sizes. I have removed the height attribute so that the images preserve their aspect ratio.



The generated files each have a different filename pattern. For example

filename-1200x374.jpg

and

filename-1200x854.jpg



I would like to change the filename to only include the width like

filename-1200.jpg

so that I can generate the correct srcset for each image from the filename string.



Is there a way to do this? Thanks!

  • discord user avatar
    denolfe
    Payload Team
    last month

    Currently, it is not possible to customize the appending of the dimensions to the filename.

  • default discord avatar
    reepicheep05
    last month

    Ok thank you for the response. I have found another solution that does not require generating the URL. But I believe this would be a value addition at some point in the future.

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.