Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image metadata stripped from image when using upload.imageSizes #6951

Open
hjbugajski opened this issue Jun 26, 2024 · 0 comments
Open

Image metadata stripped from image when using upload.imageSizes #6951

hjbugajski opened this issue Jun 26, 2024 · 0 comments
Labels
status: needs-triage Possible bug which hasn't been reproduced yet v3

Comments

@hjbugajski
Copy link

Link to reproduction

https://github.com/hjbugajski/payload-3.0-stripped-metadata

Payload Version

3.0.0-beta.55

Node Version

20.14.0

Next.js Version

15.0.0-rc.0

Describe the Bug

When imageSizes is set in the collection upload config, all metadata is stripped from all image sizes, including the original image. When imageSizes is removed from the collection upload config, the metadata is preserved in the image since no transformations are done.

I believe this is due to sharp stripping all metadata by default, and when uploading multiple image sizes, the "original" image is recreated with sharp with no formatting or transformations applied, thus stripping the metadata.

Possible solutions may be to use keepMetadata or withMetadata to preserve the metadata for images, or upload the original image without using sharp.

Reproduction Steps

Steps

  1. Clone the reproduction repository.
  2. Start a MongoDB container and run the Payload application.
  3. Go to the Media collection and upload a new image (example image provided in repository).
  4. Metadata should be displayed after save.
  5. Uncomment lines 41–47 in Media.ts
  6. Create a new upload with the example image.
  7. Metadata should not be displayed after save.

Video

output_file.mp4

Adapters and Plugins

No response

@hjbugajski hjbugajski added status: needs-triage Possible bug which hasn't been reproduced yet v3 labels Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs-triage Possible bug which hasn't been reproduced yet v3
Projects
None yet
Development

No branches or pull requests

1 participant