Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

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!

share|improve this question
    
Try using background-image:JUVGJUJGJUJEJUVGJUJGJUJEJUVGJUJGJUJEJU..; – Aditya Singh Jul 29 '13 at 4:44
    
Wouldn't work; background-image: url(data:image/jpeg;base64,JUVGJUJGJUJE...); Also, please post the whole base64 string to pastebin. – Pietu1998 Jul 29 '13 at 4:49
    
Thanks Pietu, here you go: pastebin.com/fTsBCyqC – Martin Jul 29 '13 at 4:54
    
@Martin Decoded it, but couldn't manage to open it. 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. – Pietu1998 Jul 29 '13 at 5:20
    
What happens if you leave off the ;base64? What you show is not base64 encoded. – Jim Garrison Jul 29 '13 at 6:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.