How-to articles, tricks, and solutions about BASE64

Base64 Java encode and decode a string

To encode and decode a string in Base64 in Java, you can use the java.util.Base64 class.

Convert Base64 string to an image file?

To convert a Base64 string to an image file in PHP, you can use the base64_decode() function to decode the Base64 string and then save it as an image file using file_put_contents().

Decode Base64 data in Java

To decode base64 data in Java, you can use the Base64.Decoder class introduced in Java 8. Here's an example of how to use it:

Encoding as Base64 in Java

To encode a string as Base64 in Java, you can use the java.util.Base64 class. Here's an example of how you can use the Base64 class to encode a string:

How to convert an image to Base64 encoding

To convert an image to base64 encoding in PHP, you can use the base64_encode() function

How to Display Base64 Images in HTML

In this snippet, we’re going to demonstrate how you can display Base64 images in HTML. Use the HTML <img> element to embed Base64 encoded image into HTML.

PHP - get base64 img string decode and save as jpg (resulting empty image )

To decode a base64 encoded image string and save it as a JPG file in PHP, you can use the following code: