Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

204
Vistas
Convert url image to base64 on server side js

Hi I am working on a project where I save image files to Cloudinary. And store url of the image location and pass it to server side. From the server side I save the image urls to database. Then I have to generate a pdf with those images and send an email.(I am doing this through same api where I save image paths to database).

I am using jsPDF.

on front end I have a preview function where I could display cloudinary url of the image

  doc.addImage(file, 'PNG', 198, 50, 110, 80, '', 'FAST', 90);

[here file is accessed through html element)

And this code works and can see the pdf preview of the image.

But when I try to do the same in server side

 doc.addImage(e.image, 'PNG', 198, 50, 110, 80, '', 'FAST', 90);

this line gives a timeout and failure response to my api. If I comment this out it works pdf is created with no Image.(Both file and e.image are cloudinary image urls, images exists).

I need to create this pdf on server. I got the clue as that it takes time to load this image(which does not happen in preview function in front end) and according to google I need to convert it to base64.Now since I am in server is there a way I can convert my url to a base64 string. What I tried so far did not work. Or is there a better work around for this?.

Sending base64 through api is not possible because of file size problem and api object can have several images in one purchase.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda