Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

196
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda