Last post Jan 06, 2013 08:38 PM by Decker Dong - MSFT
Jan 05, 2013 09:36 PM|keerthna|LINK
Anyone please help me out .
I have stored image in access database as bitmap image,datatype as ole object. I tried to access the image from access database using asp.net code and return to jquery ajax call in json format.
The problem I am facing is :
When I retrieve image from DB , i am getting as bytes.I have encoded and sent to jquery but when I decoded it in jquery and dislayed it in html img tag I am getting special characters and some unrecognised characters of long length.I hope the problem is
in bytes retrieved from DB.Because I have used image to base64 encoder online ,converted the image to base64 and decoded it in jquery and dislayed it in html img tag.I got the perfect image in this case.
Please help me out. I heve to comlete it by today..
Thanks in Advance..
Jan 06, 2013 04:26 AM|Mikesdotnetting|LINK
You shouldn't need to encode or decode the image before returning it to your Jquery code. You should just use Response.BinaryWrite on the byte array that is extracted from the database and send the actual image file.
Here's an article that shows how to do that using a Generic Handler (ashx file): http://www.mikesdotnetting.com/Article/123/Storing-Files-and-Images-in-Access-with-ASP.NET
Jan 06, 2013 08:38 PM|Decker Dong - MSFT|LINK
When I retrieve image from DB , i am getting as bytes.I have encoded and sent to jquery
If you save a virtual relative path to db and fetch it out, maybe you can use encypt or decypt to prorect the data's security; however, if you wanna retrieve from a db's specific column value in the formation of binary collection, you have to fetch them
out directly without using encypt or decypt. No need for that. Because (as far as I see), no-one can recognize what the binary collection means in fact.