PHP HTML image output

后端 未结 4 1232
终归单人心
终归单人心 2021-02-08 08:02

In the PHP manual for base64_encode() I saw the following script for outputting an image.



        
4条回答
  •  故里飘歌
    2021-02-08 08:29

    Because imagepng outputs bool or image stream directly to output.
    So, in order to get image data you should use output buffers like this:

    ob_start();
    imagepng($im);
    $image = ob_get_contents();
    ob_end_clean();
    echo '';
    

提交回复
热议问题