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

Usage Example could be added to readme #52

Open
atlas-wong opened this issue Nov 15, 2022 · 0 comments
Open

Usage Example could be added to readme #52

atlas-wong opened this issue Nov 15, 2022 · 0 comments

Comments

@atlas-wong
Copy link

I think my usage may be useful for other, jquery used
I replace the user selected image with compressed one (currently only convert single image, if multiple needed, this sample just for your reference):

<script src="https://cdn.jsdelivr.net/gh/WangYuLue/image-conversion/build/conversion.js"></script> <script> async function compressImage(e) { const file = $(e).prop('files'); const res = await imageConversion.compressAccurately(file[0],200); const dT = new DataTransfer(); dT.items.add(new File([res], file[0]['name'])); $(e).prop('files', dT.files); } </script>
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