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

Upload collection formatOptions affect only the original image upload, not other generated sizes specified in the collection #10020

Open
azivkovi opened this issue Dec 17, 2024 · 0 comments

Comments

@azivkovi
Copy link
Contributor

Describe the Bug

export const Media: CollectionConfig = {
  slug: 'media',
  upload: {
    formatOptions: {
      format: 'jpeg',
      options: {
        quality: 75,
      },
    },
    imageSizes: [
      {
        name: 'thumbnail',
        width: 300,
      }
    ],
  },
// ...
}

When uploading a png to this collection, I expect it to be transformed to jpg and saved as such. This happens for the main image, but other sizes that are specified are generated with file extension of the image being uploaded, that being png in this case. I would expect the other sizes to be saved as jpg as well.

Example with png uploaded image:
Image

Link to the code that reproduces this issue

https://github.com/azivkovi/payload-test.git

Reproduction Steps

  1. Login to admin panel
  2. Select Media collection
  3. Upload an image with extension other than jpg (e.g. png)
  4. Observe that the original image is now jpg, but other sizes remain with extension png

Which area(s) are affected? (Select all that apply)

Not sure

Environment Info

Node.js v22.11.0

Binaries:
  Node: 22.11.0
  npm: 10.8.2
  Yarn: N/A
  pnpm: 9.15.0
Relevant Packages:
  payload: 3.8.0
  next: 15.1.0
  @payloadcms/email-nodemailer: 3.8.0
  @payloadcms/graphql: 3.8.0
  @payloadcms/live-preview: 3.8.0
  @payloadcms/live-preview-react: 3.8.0
  @payloadcms/next/utilities: 3.8.0
  @payloadcms/payload-cloud: 3.8.0
  @payloadcms/plugin-form-builder: 3.8.0
  @payloadcms/plugin-nested-docs: 3.8.0
  @payloadcms/plugin-redirects: 3.8.0
  @payloadcms/plugin-search: 3.8.0
  @payloadcms/plugin-seo: 3.8.0
  @payloadcms/richtext-lexical: 3.8.0
  @payloadcms/translations: 3.8.0
  @payloadcms/ui/shared: 3.8.0
  react: 19.0.0
  react-dom: 19.0.0
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Tue Nov 5 00:21:55 UTC 2024
  Available memory (MB): 3197
@azivkovi azivkovi added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction labels Dec 17, 2024
@PatrikKozak PatrikKozak self-assigned this Dec 18, 2024
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants