Home Forums Add-ons Gallery Field WordPress ACF Rest API, get images in base64 format


WordPress ACF Rest API, get images in base64 format

  • I’m using wordpress only for the API with custom endpoints created with ACF. I was wondering if there’s any way to return images URL + base64. I need also this format to create a PDF in my website.

    Here’s the response from wordpress API:

     id: 179,
      acf: {
       gallery: [
         ID: 700,
         id: 700,
         title: "Title",
         filename: "filename.jpg",
         filesize: 388629,
         url: "",
         link: "",
         alt: "",
         author: "2",
         description: "Description",
         caption: "Caption",
         name: "name",
         status: "inherit",
         uploaded_to: 0,
         date: "2019-04-03 14:05:27",
         modified: "2019-04-03 14:06:11",
         menu_order: 0,
         mime_type: "image/jpeg",
         type: "image",
         subtype: "jpeg",
         icon: "",
         width: 1200,
         height: 1600,
          sizes: {
            thumbnail: "",
            thumbnail-width: 150,
            thumbnail-height: 150,
            medium: "",
            medium-width: 225,
            medium-height: 300,
            medium_large: "",
            medium_large-width: 640,
            medium_large-height: 853,
            large: "",
            large-width: 640,
            large-height: 853

    Is there any way that base64 image format can appear also in json ?

    I’m using [jsPDF][1] to create pdf:

          const doc = new jsPDF("l", "mm", "a4");
  => (
            doc.addPage("l", "mm", "a4")
            doc.text(35, 25, item.title)
            doc.addImage(item.BASE64, 'JPEG', 15, 40, 180, 160)



Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.