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

Respect "Size optimization" setting on image resize #14705

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

krestaino
Copy link

@krestaino krestaino commented Oct 23, 2022

What does it do?

When "Responsive friendly upload" is enabled, the resized images are using default quality options (80) even with "Size optimization" disabled. This PR just checks whether "Size optimization" is enabled or not during the resizing process.

Why is it needed?

Resized images are compressed even with "Size optimization" disabled.

How to test it?

  1. Enable "Responsive friendly upload" and disable "Size optimization", upload an image and check the quality and file size of the resized images.
  2. Pull this PR and do the same test, you'll notice the resized images are larger in file size and of better quality.
  3. Disable "Size optimization" and test again. You'll see the resized images are compressed again.

@krestaino
Copy link
Author

I just pushed a new commit which allows you to configure options per format in config/plugins.js. For example:

module.exports = () => ({
  upload: {
    config: {
      formats: {
        jpeg: {
          chromaSubsampling: '4:4:4',
          quality: 95
        },
        png: {
          compressionLevel: 9,
          progressive: true
        }
      }
    }
  }
});

@stb13579 stb13579 added the flag: documentation This PR requires a documentation update label Oct 24, 2022
@joshuaellis joshuaellis added source: core:upload Source is core/upload package pr: fix This PR is fixing a bug and removed flag: documentation This PR requires a documentation update labels Oct 24, 2022
@krestaino
Copy link
Author

Is there anything I can do to help get this merged in?

@Marc-Roig Marc-Roig added the flag: documentation This PR requires a documentation update label Mar 2, 2023
@krestaino
Copy link
Author

I've added documentation.

strapi/documentation#1768

@hanpaine hanpaine removed the request for review from jhoward1994 March 21, 2024 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flag: documentation This PR requires a documentation update pr: fix This PR is fixing a bug source: core:upload Source is core/upload package
Projects
Status: To be reviewed
Development

Successfully merging this pull request may close these issues.

None yet

5 participants