|
Hi,
I am using this code to upload using Ajaxuploader:
using (Stream stream = item.OpenStream())
{
using (System.Drawing.Image img = System.Drawing.Image.FromStream(stream))
{
img.Save(Server.MapPath(String.Format("{0}/{1}/posts/{2}/{3}.png", Application["MemberMediaDirectory"], Session["volow_member_guid"], RouteData.Values["GUID"], image_guid)), ImageFormat.Png);
}
}
I want to know how can I resize the image before uploading to 906width X 360height?
Technology News @ www.JassimRahma.com
|
|
|
|
|
You can't. submitting files to a website is voluntary, and the user has to choose which files to submit.
Websites that run in a browser on the client system run in a protective bubble, that is separated from the operating system. Sort of a sealed container.
You can resize the image after uploading by using system.drawing, measuring the size of the uploaded image, calculating the new height and width, and the new canvas size, and then creating a new blank canvas, and then overlay the original image over the canvas and save the new file.
Or you can write several programs in c++ to run on the client computer such as Linux, OSX, Windows, that will resize, and transmit the new bytestream to a webservice as a non-primitive, and then make the write to the disk drive.
|
|
|
|
|
Have a look at Plupload[^]. In a modern browser, it supports resizing PNG and JPEG files before uploading.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|