You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>
The text was updated successfully, but these errors were encountered:
I think my usage may be useful for other, jquery used
<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>I replace the user selected image with compressed one (currently only convert single image, if multiple needed, this sample just for your reference):
The text was updated successfully, but these errors were encountered: