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

Can resizeImage be a callback? #1834

Open
erikzhang opened this issue Feb 28, 2023 · 0 comments
Open

Can resizeImage be a callback? #1834

erikzhang opened this issue Feb 28, 2023 · 0 comments

Comments

@erikzhang
Copy link

erikzhang commented Feb 28, 2023

It would be great if resizeImage was a callback that allowed me to define the complex logic of which/how images should be resized.

For example:

{
    resizeImage: function (width, height) {
        const min = Math.min(width, height);
        if (min <= 1200) return false;
        if (width > height) {
            width = width / height * 1080;
            height = 1080;
        }
        else {
            height = height / width * 1080;
            width = 1080;
        }
        return { maxImageWidth: width, maxImageHeight: height };
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant