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

78
Views
iOS cambia el tamaño de la imagen con el lienzo da como resultado una imagen en negro

Estoy tratando de cambiar el tamaño de varias imágenes en el navegador (los mismos resultados en Chrome y Safari) usando lienzo, para luego guardarlas en IndexedDB a través de Dexie.js. Todo funciona bien en Android, pero en iOS (probado en iPhone 8 y X) 1 o 2 imágenes aleatorias dan como resultado imágenes en negro. ¿Cuál podría ser el problema? Esta es la función que estoy usando:

 photoHeightMax = 1100; photoWidthMax = 1100; resizeBase64Img(src) { return new Promise((resolve, reject) => { const img = new Image(); img.src = src; img.onload = () => { const imgWidth = img.width; const imgHeight = img.height; const scale = Math.min(this.photoWidthMax / imgWidth, this.photoHeightMax / imgHeight); const widthScaled = scale > 1 ? imgWidth : imgWidth * scale; const heightScaled = scale > 1 ? imgHeight : imgHeight * scale; const elem = document.createElement('canvas'); elem.width = widthScaled; elem.height = heightScaled; const ctx = elem.getContext('2d'); ctx.drawImage(img, 0, 0, widthScaled, heightScaled); const data = ctx.canvas.toDataURL('image/jpeg', 0.85); resolve(data); }; img.onerror = (error) => reject(error); }); }

¡Cualquier ayuda sería apreciada!

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!