Hey guys, I'm hoping someone can gelp me try to get a snipet of code working that i've been having problems with. What I'm trying to accomplish is to get a picture from a users computer with ASP.net with a C# backend, convert that picture to an System.Drawing.Image so I can then use GDI in order to resize the image, save it as a JPG, and then convert it to a stream so I can pipe it out to my database. The code I have currently, although it doesn't throw any build errors or runtime errors, it just simply doesn't work.

If anyone can see something wrong, or has a suggestion of a different way to do it, please let me know.

Thanks!!

if(pic.PostedFile != null)
{
string picType = pic.PostedFile.ContentType.ToString();
int picSize = pic.PostedFile.ContentLength;
							
								System.Drawing.Image picTemp = System.Drawing.Image.FromStream(pic.PostedFile.InputStream);
								
								System.Drawing.Image imgPhototemp = FixedSize(picTemp, 200, 250);
								
MemoryStream picStream = new MemoryStream();

								imgPhototemp.Save(picStream,System.Drawing.Imaging.ImageFormat.Jpeg);

int picLength = (int)picStream.Length;
byte[] picBuffer = new byte[picLength];
									
								picStream.Read(picBuffer,0,picLength);
						
addRow.Pic = picBuffer;
}

Go to asp.net's forum great stuff there.

cheers'
jamesonh20

Go to asp.net's forum great stuff there.

cheers'
jamesonh20

You're almost 4 years late, but thanks for the heads up...lol.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.