图像在asp.net中调整大小 [英] image resize in asp.net
本文介绍了图像在asp.net中调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
如何使用C#在fileupload控件中上传图像时调整图像大小并保存到文件夹中。
Hi All,
how to resize image and save into folder when uploading image in fileupload control using C#.
推荐答案
请参阅此链接回答你的问题
如何在uploadnig之前检查图像的大小? [ ^ ]
此链接可以帮助您将图像保存到文件夹中。
http://www.aspdotnet-suresh.com/2011/03/how-to-save-images-into-folder-and.html 一> [ ^ ]
Refer this link to answer you question
How can I check the size of the images before uploadnig ?[^]
This link answers you to save image into a folder.
http://www.aspdotnet-suresh.com/2011/03/how-to-save-images-into-folder-and.html[^]
如果你正在工作使用ASP.NET Web页面,Web窗体或MVC,无论您使用何种类型的技术。您可以使用WebImage
对象并使用它。
它有许多内置功能,你可以使用,调整大小或做你想做的事情。
http:/ /www.asp.net/web-pages/tutorials/files,-images,-and-media/9-working-with-images [ ^ ]使用此链接,从中了解官方的ASP.NET网站。
..或者你可以从MSDN中学到它: http://msdn.microsoft.com/en-us/library/system.web.helpers.webimage(v = vs.111)的.aspx [ ^ ]
处理它的示例代码如下:
If you're working with ASP.NET Web Pages, Web Forms or MVC no matter what type of technology you're using. You can use theWebImage
object and work with it.
It has many built-in functions that you can use, to resize or to do what so ever you want to do.
http://www.asp.net/web-pages/tutorials/files,-images,-and-media/9-working-with-images[^] Use this link, to learn this from the official ASP.NET website.
.. or you can learn it from the MSDN : http://msdn.microsoft.com/en-us/library/system.web.helpers.webimage(v=vs.111).aspx[^]
Sample code to deal with it is as:
// get the image from the request and work with it.
var photo = new WebImage().GetImageFromRequest();
// this code below does the job of resizing.
photo.Resize(width: 60, height: 60, preserveAspectRatio: true,
preventEnlarge: true);
还要记住,ASP.NET Web Pages NuGet助手中的FileUpload控件还将整个代码转换为HTML代码。
Also remember, FileUpload control in the ASP.NET Web Pages NuGet helper also converts the entire code to the HTML code.
查看以下链接..
http:// www.aspdotnet-suresh.com/2011/05/how-to-resize-size-image-without-losing.html [ ^ ]
Look at below link..
http://www.aspdotnet-suresh.com/2011/05/how-to-resize-size-image-without-losing.html[^]
这篇关于图像在asp.net中调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文