How does js canvas compress pictures?

the requirement is to implement compressed upload. Most of them are realized by canvas method on the Internet, so I wrote one after it. But it doesn"t seem to work. After uploading, the downloaded picture is still very large.
the code is as follows

        html5Reader(file, item){

            const reader = new FileReader();
            let Img = new Image();
            let newImageData;
            Img.src =  window.URL.createObjectURL(file);
            Img.onload = (e) => {
                let canvas = document.createElement("canvas");
                let ctx = canvas.getContext("2d");                       
                canvas.width = Img.width;
                canvas.height = Img.height;
                ctx.drawImage(Img, 0, 0, canvas.width, canvas.height);
                newImageData = canvas.toDataURL("image/jpeg", 0.1);
                console.log(newImageData)                    
                this.$set(item, "src", newImageData);
            };                


        },
Mar.19,2021

problem solved.
you need to upload base64 images into ordinary images.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be593c-31780.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be593c-31780.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?