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..
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.
When I retrieve image from DB , i am getting as bytes.I have encoded and sent to jquery
Hi,
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.
keerthna
0 Points
2 Posts
How to retrieve image from access database using webservice and to return to jquery ajax call
Jan 06, 2013 01:36 AM|LINK
Hi,
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..
Mikesdotnett...
All-Star
154858 Points
19858 Posts
Moderator
MVP
Re: How to retrieve image from access database using webservice and to return to jquery ajax call
Jan 06, 2013 08:26 AM|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
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: How to retrieve image from access database using webservice and to return to jquery ajax call
Jan 07, 2013 12:38 AM|LINK
Hi,
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.
Reguards!