Posts

Showing posts from June, 2025

Homesit

$scope.compressImageAndUpload = async function() {     const fileInput = $scope.view.wdg['FileUpload-1'].file;     if (!fileInput || fileInput.length === 0) {         alert("Please select an image first.");         return;     }     const file = fileInput[0];     const compressedBase64 = await compressImage(file);     const byteCharacters = atob(compressedBase64);     const byteNumbers = Array.from(byteCharacters, c => c.charCodeAt(0));     const byteArray = new Uint8Array(byteNumbers);     const compressedBlob = new Blob([byteArray], { type: "image/jpeg" });     uploadToRepository(compressedBlob, file.name); }; function compressImage(file) {     return new Promise((resolve, reject) => {         const reader = new FileReader();         reader.readAsDataURL(file);         rea...