0

I'm using the base-64 npm but how can it's returning random characters. Is there any way I can decode a string and product a png image file?

JorahFriendzone
  • 439
  • 1
  • 4
  • 21
  • Check this answer https://stackoverflow.com/questions/6926016/nodejs-saving-a-base64-encoded-image-to-disk – Amr Labib Oct 11 '17 at 19:14

1 Answers1

0

If you are using React create a component like-so:

class Base64Image extends React.Component{
  render() {
     return <img
       src={"data:image/jpeg;" + 
         this.props.imageBase64String} 
     />
  }
}

``

To use the component, Assuming you have a base64Image variable:

<Base64Image imageBase64String={base64Image} />
yahyazini
  • 700
  • 12
  • 23