osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Converting hex data to image


On Thursday, November 14, 2013 at 9:02:52 PM UTC+5:30, Shyam Parimal Katti wrote:
> I am implementing an authentication system(in Django) using LDAP as the backend(django-auth-ldap). When we fetch the data from the LDAP server for a particular valid user, the data associated with the user contains the thumbnail photo in hex representation. E.x.:
> 
> 
> [('CN=XX,OU=Users,OU=Accounts,DC=test,DC=com', {'msExchBlockedSendersHash': ['\xce'], 'mailNickname': ['test_user'], 'primaryGroupID': ['513'], 'logonCount': ['1021'], thumbnailPhoto: ['\xef\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x00`\x00`\x00\x00\xff\xdb\x00C\x00\x08\x06\x06\x07\x06\x05\x08\x07\x07\x07\t\t\x08\n\x0c\x14\r\x0c.....'] ...... ]
> 
> 
> How do I convert the hex data for an image to the actual image?
> 
> Any help would be greatly appreciated.
> 
> 
> Thanks,
> Shyam

Hey,
It shows the same error.
I am actually getting that image from ldap in bytes: '\xef\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x00`\x00`\x00\x00\xff\xdb\x00C\x00\x08\x06\x06\x07\x06\x05\x08\x07\x07\x07\t\t\x08\n\x0c\x14\r\x0c.....
I want to display this image on my template.