Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

235
Views
Compress images and covert them to base64 in javascript

i have an app in JavaScript where a user can upload an image and it will save it in a database after converting it to base64 string, now i want the images to be compressed so it wont take as much space in the DB. here is my current code with out compression.

  this.imgUrl = "";
  const imgs = event.target.files;
  let imgName = imgs[0].name;

  if (imgName.lastIndexOf(".") <= 0) {
    //invalid file
  } else {
    const fileReader = new FileReader();
    fileReader.addEventListener("load", () => {
      this.imgUrl = fileReader.result;
    });
    fileReader.readAsDataURL(imgs[0]);
  }

I would like to hear your thoughts. (Using Vue btw) Thank you!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!