PHP - 如何将字节数组转换为图像文件? [重复]

This question already has an answer here:

Using Java SDK i have JPEG byte array. Now using PHP i need to show that byte array into JPEG picture using tag.

How can i convert byte array to readable JPEG? Tried this but its not showing the picture at all.

$byteArray = "[A@53d9e469"; //something like this Java generated
$img = "<img src= 'data:image/jpeg;base64, $byteArray' />";
echo ($img);

EDIT:

I have tried $byteArray = base64_encode($byteArray); but that is not working.

</div>