base64与图片输出屏幕

if ($base64) {
    ob_start();
    // 输出图像
    imagepng($this->_image);
    imagedestroy($this->_image);
    $image_data = ob_get_contents();
    ob_end_clean ();
    $image_data_base64 = "data:image/png;base64,". base64_encode ($image_data);
    $json = new Json();
    $json->S($image_data_base64);
} else {
    header('Cache-Control: private, max-age=0, no-store, no-cache, must-revalidate');
    header('Cache-Control: post-check=0, pre-check=0', false);
    header('Pragma: no-cache');
    header("content-type: image/png");
    // 输出图像
    imagepng($this->_image);
    imagedestroy($this->_image);
}

base64与图片输出屏幕_第1张图片

{
    "errno": 0,
    "errdesc": "操作成功",
    "timestamp": 1575036206,
    "data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAB4CAMAAAAzDfCvAAAAYFBMVEXz+/5/Onyaz8OXrb3btsDUyqu32JjTw96bvbK2pbfhx9LNppvWyt2qgqzk4u3Hss2capy5mr2NUoyQi52Ja5CUnKSXrKuGWomvl6+hfKC0lJmUXoeJTIHJuKWpgpOecI3PC2mTAAAPf0lEQVR4nO2di5arqBKGta+TNHLx3OfMnHn/tzxAFYiKSnEx7u78a0/WnuwECR9UFQVi152rt7c3/d/Rp/rH6oyG+EEyvN/i0D8/J9gT9YD/vCuc0DEOfkt5CT9DgDsC3TVSv/zLQ6nvq7wCp7f/QxSBPm/AH0Z9XeQ31Az6rOWe1GPlfw+BT5812ZN64rUq6n6vWdqhbP2j1D+XDfmkvnnVUp3GPGyl6CB/Us+4/HUVNs8O9SwLX6FmZc1eXkQVVQFVS7ZC/fRagXrLqma0dt7XmqlZ8xAasRr102ue3MqkT5+nnd/XxqfDVafXfOqPVVrr5kE5TeufVT96t9fpF69k6pcSuVWpJZyilo1TSP1HqjHuherWu4z6U4GuDz1GlkL9qQNdDfocKpX6U3Q9GHoEeDr1p8p1NvQt4AnUn6qt26099F3gu9SfaqLbbXptAf0Y+Bb1p5ophO5VCXoi8KdBP1tR6F750CnAnwb9ZO1D9yJBJwNfD/Cvr6xfU1/80RVoIsP7d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