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.

Is there a way to get the original size of an image when uploading an image to the Media collection?

default discord avatar
eddiedev2 years ago
2

I'm currently uploading an image to a s3 bucket via Media Collection using the beforeChange hook. After using the GetObjectCommand to retrieve the image from s3, I am trying to do a file size check on the image file to make sure it isn't a duplicate image being uploaded. However, the filesize property inside the Media collection record displays a smaller size, than the original image size. Is there a way to get the original image size? (My assumption is that payload is compressing the image behind the scenes using sharp). Images attached. TY.

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.