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

default discord avatar
5 months ago

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.

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


Connect with the Payload Community on Discord



Can't find what you're looking for?

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