3

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.

javabrett
  • 7,020
  • 4
  • 51
  • 73

1 Answers1

0

make sure you go from bytes array to base 64. see: How to convert image into byte array and byte array to base64 String in android?

Community
  • 1
  • 1
Gal Samuel
  • 493
  • 2
  • 12
  • This is not for Android. this is not working `String imgString = Base64.encodeToString(getBytesFromBitmap(someImg), Base64.NO_WRAP);` –  May 27 '15 at 08:11