Converting a byte array into an image using PHP and HTML

前端 未结 3 647
臣服心动
臣服心动 2020-12-03 20:11

I\'m using PHP to retrieve data from a SOAP service, part of which is a byte array of an image encoded in base64, and I\'d like to display that image in the browser. The da

3条回答
  •  爱一瞬间的悲伤
    2020-12-03 20:25

    You need to base64 encode the data. This is required and ensures that charset conversions don't touch the data.

    The correct code should be

    $imgData = base64_encode($byteArray);
    $img = "";
    print($img);
    

提交回复
热议问题