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

195
Views
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
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!