Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a byte variable
Public img As Byte() = Nothing

and i am taking image (binary data) in this from sql server database

I am passing it through querystring in this way from javascript
var img = '<%= img %>';
window.showModalDialog("cli_image.aspx?Client_img=" + img + " ", '', WinSettings);

and retieving it in this way

Dim bt As Byte()=New System.Text.ASCIIEncoding().GetBytes(Context.Request.QueryString("Client_img"))
Response.BinaryWrite(bt)

but it is showing onle system.byte[] it should show image
Posted
Updated 6-Jan-12 23:38pm
v2

1 solution

example:
int width, height;//set some widht & height
DataRow dr;//assume you have data from db in dr.
System.Drawing.Image img = (System.Drawing.Image)imgConverter.ConvertFrom((Byte[])dr["img_person"]);
Bitmap bmp = new Bitmap(img, new Size(width, height));
Response.ContentType = "image/GIF";//gif or other format
bmp.Save(Response.OutputStream, ImageFormat.Gif);//gif or other format

do this in popup's page_load event. Remember this is Response content. So you will have whole page with just one image. If you would like to display multiple images in a page this does not work as is. You may have to do diff. way.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900