asp.net中的图像裁剪控件 [英] Image croping control in asp.net

查看:128
本文介绍了asp.net中的图像裁剪控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Assalam-o-Alaikum,

我正在制作像facebook这样的网络应用程序,但我陷入了图像的控制模式,如填充模式,拉伸模式等



我如何将图像上传到特定模式的填充模式或拉伸模式,就像调整Facebook中的封面照片大小一样?

解决方案

< blockquote> Alaikum Assalam,



如果你想在ASP.NET中裁剪和执行其他图像转换,在服务器端,你可以使用系统.Drawing 。假设你有一些形象。您可以创建其他图像的实例, System.Drawing.Bitmap 并获取的实例System.Drawing.Bitmap 出来的。它允许您绘制此位图。方法如下:

http:// msdn。 microsoft.com/en-us/library/system.drawing.graphics.fromimage.aspx [ ^ ]。



然后你可以在这个位图上做任何绘图,特别是,绘制一些其他图像,无论是拉伸还是拉伸。请查看所有不同的 System.Drawing.Graphics.DrawImage 方法:

http://msdn.microsoft.com/en-us/library/system.drawing.graphics.aspx [ ^ ]。



您可以将图像保存在文件中,但通常使用适当的媒体类型在HTTP响应中立即传送图像,而不使用任何文件。有关使用图像的示例,请参阅 System.Web.HttpResponse 上的此MDSN页面:

http://msdn.microsoft.com/en-us/library/system.web.httpresponse.aspx [< a href =http://msdn.microsoft.com/en-us/library/system.web.httpresponse.aspxtarget =_ blanktitle =New Window> ^ ]。



祝你好运,

-SA


使用一些jquery技巧

http:// www.mikesdotnetting.com/Article/95/Upload-and-Crop-Images-with-jQuery-JCrop-and-ASP.NET [ ^ ]


Assalam-o-Alaikum,
I am making a web application like facebook, But i am stuck at control mode of image, like fill mode, stretch mode etc

How can I upload an image to a particular mode either fill mode or stretch mode, just like to resize cover photo in facebook?

解决方案

Alaikum Assalam,

If you want to crop and perform other image transformation in ASP.NET, on server side, you can use System.Drawing. Suppose you have some image. You can create an instance of other image, System.Drawing.Bitmap and get the instance of System.Drawing.Bitmap out of it. It allows you to draw on this bitmap. Here is how:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fromimage.aspx[^].

Then you can do any drawing on this bitmap, in particular, draw some other image, either with stretch, of cropped. Please see all different System.Drawing.Graphics.DrawImage methods:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.aspx[^].

You can save the image in the file, but usually you deliver image immediately in HTTP response, without any file, using appropriate media type. Please see this MDSN page on System.Web.HttpResponse for the example of working with an image:
http://msdn.microsoft.com/en-us/library/system.web.httpresponse.aspx[^].

Good luck,
—SA


Use some jquery tricks
http://www.mikesdotnetting.com/Article/95/Upload-and-Crop-Images-with-jQuery-JCrop-and-ASP.NET[^]


这篇关于asp.net中的图像裁剪控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆