3

I'm working with this API that returns images in binary format, I need to display them on webpage, the problem is that they are coming in some weird format that simple <img> tag with src="data:image/jpeg;base64, doesn't display. The API providers have no idea what the format is and don't want to spend too much time on my questions, and they say that flash applications using the same api work fine to display images so html should as well. Anyway I need someone to at least help me identify the format so I can move forward. The data as I receive it looks like so:

����JFIF���Digilant Signature � 8���F'�*�P�^�lW�$c?��Veι$ _,�ZY���UګJ���~I���~I�u����y~�����\"��o�*�@�̋�����;$���W�K��~I���~I���~I���~I���~I���~I���#0�f>�B^��ͫ�q+��nZ�������̽t��/

when I do the btoa(encodeURIComponent( str ) to it, it comes back looking like so:

JUVGJUJGJUJEJUVGJUJGJUJEJUVGJUJGJUJEJUVGJUJGJUJEJTAwJTEwSkZJRiUwMCUwMSUwMiUwMCUwMCUwMSUwMCUwMSUwMCUwMCVFRiVCRiV ... ... SUxNFElNDAlMDUlMTRRJTQwJTA1JTE0USU0MCUxRiVFRiVCRiVCRCVFRiVCRiVCRCUyMg==

Can anyone help me identify the format so I can display images?

Thanks!

Martin
  • 31
  • 1
  • 2
  • Try using `background-image:JUVGJUJGJUJEJUVGJUJGJUJEJUVGJUJGJUJEJU..;` – Aditya Singh Jul 29 '13 at 04:44
  • Wouldn't work; `background-image: url(data:image/jpeg;base64,JUVGJUJGJUJE...);` Also, please post the whole base64 string to [pastebin](http://pastebin.com). – PurkkaKoodari Jul 29 '13 at 04:49
  • Thanks Pietu, here you go: http://pastebin.com/fTsBCyqC – Martin Jul 29 '13 at 04:54
  • @Martin Decoded it, but couldn't manage to open it. http://checkfiletype.com/ didn't know, it said it's a binary file (good job, didn't guess :D). 7-Zip couldn't open it, so it's not packed. (?) Opening with Notepad++ looks exactly like in the post, plus some control characters. – PurkkaKoodari Jul 29 '13 at 05:20
  • What happens if you leave off the `;base64`? What you show is not base64 encoded. – Jim Garrison Jul 29 '13 at 06:38
  • If, as you say, "flash applications using the same api work fine", then do you have some examples of how to use this with Flash? – Mr Lister Jul 29 '13 at 09:27
  • Thanks Guys! @JimGarrison, still can't see the image without the `;base64` @MrLister, Yes, flash just creates a Bitmap object from it, which is pretty universal and I assume it decodes it automatically. – Martin Jul 29 '13 at 23:43

0 Answers0