PHP: create image with ImagePng and convert with base64_encode in a single file?
问题 I have created an image with ImagePng(). I dont want it to save the image to the file system but want to output it on the same page as base64 encode inline Image, like print '<p><img src="data:image/png;base64,'.base64_encode(ImagePng($png)).'" alt="image 1" width="96" height="48"/></p>'; which does not work. Is this possible in a single PHP file at all? Thanks in advance! 回答1: The trick here will be to use output buffering to capture the output from imagepng() , which either sends output to