Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react image compression

import imageCompression from "browser-image-compression";

export const lighterImage = (file) => {
  return new Promise(function (resolve, reject) {
    var options = {
      maxSizeMB: 0.5,
      maxWidthOrHeight: 800,
      useWebWorker: true,
    };
    imageCompression(file, options)
      .then(function (compressedFile) {
        resolve(compressedFile);
        // resolve compresed file
      })
      .catch(function (error) {
        reject(error);
      });
  });
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: select remove option jquery 
Javascript :: jquery datatable iterate all rows 
Javascript :: find only duplicate data javascript object 
Javascript :: loadash sort by order of another array 
Javascript :: express bodyparser deprecated 
Javascript :: convert timestamp to date javascript 
Javascript :: hashmap iteration javascirpt 
Javascript :: html2pdf cdn 
Javascript :: sum row values in datatable jquery 
Javascript :: get data from csv using vue js 
Javascript :: why does my page reloads on form submission 
Javascript :: react date picker disable past dates 
Javascript :: javascript document remove 
Javascript :: js dynamicly add script 
Javascript :: in puppeteer wait for page untile certain selector have certain value 
Javascript :: convert map to object/JSON javascript 
Javascript :: set cursor type javascript 
Javascript :: xhr post send 
Javascript :: javascript string unique characters 
Javascript :: get the integer after decimal in javascript 
Javascript :: console.time in javascript 
Javascript :: pymongo add json to collection 
Javascript :: tolowercase 
Javascript :: how to divide array in two parts in js 
Javascript :: call function on modal open 
Javascript :: do you need a semicolon in javascript 
Javascript :: js insert before 
Javascript :: rounding off numbers javascript 
Javascript :: draw image onto canvas js 
Javascript :: smooth scroll to target with offset 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =