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.

PayloadCMS Image URL Directly from S3 Storage

default discord avatar
zed0547last year
6
  • default discord avatar
    .jynzolast year

    ha thanks, this will be very cost effective solution

  • default discord avatar
    zed0547last year

    My pleasure

  • default discord avatar
    .jynzolast year

    in what case this is used?



    For example in my frontend i dont want to fetch images from /api/media because this will make heavy request and not cost effective on vercel.



    Is there another use-cases ?



    I'm asking because I would not find it easy.



    I did something similar for admin panel also:



    // Media Collection
    upload: {
            disableLocalStorage: true,
            // To not return images in /admin via /api -> this goes throught nextjs
            adminThumbnail: ({ doc }) => {
                return `${process.env.S3_URL}/${process.env.S3_BUCKET}/${doc.filename}`
            },


    Is that good practice ?

  • default discord avatar
    zed0547last year

    That's exactly the use-case. It also means no excess computation for media collections which are already public facing



    For adminThumbnail it's fine

  • default discord avatar
    .jynzolast year

    Thank you man, you drive this community very hard 😄 hope paid enough

  • default discord avatar
    zed0547last year

    My pay is having users like you make super awesome projects with Payload hahah, again it's my pleasure

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.