However, I do not know how to show new image to user in ajax style.
protected void ProcessUpload(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e) does image upload and at the end of this method i have newFileName which contains path to new filename. How to show this new image to user?
For resizing, I'd suggest using the imageresizing.net library. Using System.Drawing properly is so difficult that Microsoft stopped supporting it completely.
renathy
Member
102 Points
94 Posts
file upload and image reiseze
Feb 03, 2012 11:12 AM|LINK
How can I resize image dynamically using Ajax file upload?
string filePath = getFilePath();stringfilename = System.IO.Path.GetFileName(AsyncFileUpload1.FileName);AsyncFileUpload1.SaveAs(filePath+"/"+ filename);This saves original image, but I need to resize it and only then save and display to user.
Rajneesh Ver...
All-Star
37166 Points
6818 Posts
Re: file upload and image reiseze
Feb 03, 2012 11:16 AM|LINK
Do as:
http://weblogs.asp.net/markmcdonnell/archive/2008/03/09/resize-image-before-uploading-to-server.aspx
And if you want to store in database then see:
http://www.csharpaspnetarticles.com/2010/02/resize-image-upload-ms-sql-database.html
www.rajneeshverma.com
Keep Forums Clean || Use Alert Moderators.
XIII
All-Star
182690 Points
23458 Posts
ASPInsiders
Moderator
MVP
Re: file upload and image reiseze
Feb 03, 2012 11:17 AM|LINK
Hi,
you need to make use of GDI+ for resizing: http://www.bing.com/search?q=gdi%2B+resize+image&src=ie9tr. If you have specific questions about this then post these in the the dedicated forum: http://forums.asp.net/150.aspx/1?System+Drawing+GDI+.
Grz, Kris.
Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
renathy
Member
102 Points
94 Posts
Re: file upload and image reiseze
Feb 04, 2012 02:36 PM|LINK
Thank you for those links.
I can resize and save image dynamically now.
However, I do not know how to show new image to user in ajax style.
protected void ProcessUpload(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e) does image upload and at the end of this method i have newFileName which contains path to new filename. How to show this new image to user?
chetan.sarod...
All-Star
65749 Points
11148 Posts
Re: file upload and image reiseze
Feb 06, 2012 02:30 AM|LINK
Hi.
These links will get you started:
http://www.codeproject.com/KB/aspnet/fileupload.aspx (File Upload with ASP.NET)
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.aspx (FileUpload Class)
or you can use Ajax Control Kit and the AsyncFileUpload
http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/AsyncFileUpload/AsyncFileUpload.aspx (AsyncFileUpload Demonstration)
resizing image::
http://www.4guysfromrolla.com/articles/012203-1.aspx (True Image Resizing)
http://weblogs.asp.net/gunnarpeipman/archive/2009/04/02/resizing-images-without-loss-of-quality.aspx (Resizing images without loss of quality)
http://www.codeproject.com/KB/web-image/pnguploader.aspx (Dynamically resize uploaded images & save in PNG format)
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
nathanael.jo...
Member
137 Points
37 Posts
Re: file upload and image reiseze
Feb 22, 2012 07:37 PM|LINK
For resizing, I'd suggest using the imageresizing.net library. Using System.Drawing properly is so difficult that Microsoft stopped supporting it completely.