{ let reader = new FileReader(); reader.onload = (event) => { let originalImageUrl = `${event.target.result}`; const img = new Image(); img.src = originalImageUrl; img.onload = function () { const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); // Set canvas dimensions to the original image dimensions canvas.width = img.width; canvas.height = img.height; // Draw the original image on the canvas ctx.drawImage(img, 0, 0); // Get the base64 representation of the compressed image const compressedSrc = canvas.toDataURL('image/jpeg', 0.1); // Display the compressed image imageUrl = compressedSrc; inputFiles = null; }; }; if ( inputFiles && inputFiles.length > 0 && ['image/gif', 'image/jpeg', 'image/png'].includes(inputFiles[0]['type']) ) { reader.readAsDataURL(inputFiles[0]); } else { console.log(`Unsupported File Type '${inputFiles[0]['type']}'.`); inputFiles = null; } }} />
My Modelfiles

{ submitHandler(); }} >
Name*
Description*
Modelfile
{#if raw}
Content*