Help Resizing Image, PLEASE!!

Please support our C# advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Mar 2006
Posts: 1
Reputation: aaj23 is an unknown quantity at this point 
Solved Threads: 0
aaj23 aaj23 is offline Offline
Newbie Poster

Help Resizing Image, PLEASE!!

 
0
  #1
Mar 12th, 2006
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;
}
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 78
Reputation: chrisranjana is an unknown quantity at this point 
Solved Threads: 3
chrisranjana chrisranjana is offline Offline
Junior Poster in Training

Re: Help Resizing Image, PLEASE!!

 
0
  #2
Apr 3rd, 2006
Not sure but here is an article where you can take hints from

http://www.csharp-station.com/Articles/Thumbnails.aspx
Chris, Director, Chrisranjana.com
Web developers and software programmers.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC