This PHP example program demonstrates how to encode an image as base 64 data.
<!DOCTYPE html> <html> <head> </head> <body> <?php // Read the raw image data $qImageData = File_Get_Contents('XoaXLogoNew.png'); // Encode the image string data in base 64 $qBase64data = Base64_Encode($qImageData); // The display the image as a base 64 image and the base 64 image data echo '<img src="data:image/png;base64,'.$qBase64data.'" /><br />'; echo '<textarea rows="100" cols="100" style="resize: none;" readonly>'. 'data:image/png;base64,'.$qBase64data.'</textarea>'; ?> </body> </html>
© 20072025 XoaX.net LLC. All rights reserved.