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

145
Views
Javascript cambia el tamaño de la imagen base64

Tengo una función que envía una imagen base64 a mi entrada, pero quiero cambiar el tamaño de la imagen antes de enviarla a la entrada. Necesito una imagen de 250x250, pero cuando tomo una foto desde el móvil, la imagen es de 3096x3096...

Ahí está mi código:

 function sendPhoto() { if (this.files && this.files[0]) { var FR = new FileReader(); FR.addEventListener('load', function (e) { var permitted_files = ['image/png', 'image/jpeg', 'image/bmp']; var baseImg = e.target.result; var parteImg = baseImg.substring(11, 15); if (parteImg.includes('jpeg') || parteImg.includes('png') || parteImg.includes('bmp')) { document.getElementById('sendedPhoto').src = e.target.result; document.getElementById('btnPhoto').style.display = ''; } else { $('body').overhang({ type: 'error', message: 'This is not an image file.', }); document.getElementById('uploadFoto').value = ''; } }); FR.readAsDataURL(this.files[0]); } }

¿Algunas ideas? ¡Gracias!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede usar HTML5 Canvas para hacer eso Consulte: Imagen de Canvas

about 4 years ago · Juan Pablo Isaza Report
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!