我需要掌握上载的形象,转播图像,将其节省到数据库。 简言之,除我没有机会向服务器节省任何时间档案外。 I m 拍摄图像,将图像做成比图,需要将其保存到数据库领域,作为原始图像类型(例如JPG)。 我怎么能这样获得档案馆,以便我能将其留给数据库?
在我使用图象上载之前,FileBytes()但现在,我转而处理图像和比特图的Im,而不是文件上载,似乎可以发现任何会给我带来的东西。
感谢!
我需要掌握上载的形象,转播图像,将其节省到数据库。 简言之,除我没有机会向服务器节省任何时间档案外。 I m 拍摄图像,将图像做成比图,需要将其保存到数据库领域,作为原始图像类型(例如JPG)。 我怎么能这样获得档案馆,以便我能将其留给数据库?
在我使用图象上载之前,FileBytes()但现在,我转而处理图像和比特图的Im,而不是文件上载,似乎可以发现任何会给我带来的东西。
感谢!
见Resizing an Value同时又不丧失任何质量。 然后,你可以把你的形象(Bitmap.Save ToStream)写到记忆犹新,并叫ToArray去接受tes。
它实际上并不简单......有28 ,你在图像转播时应当看到这些缺陷。 它最能利用我的
在这里,如何在经过改造、耕作和改用Jpeg格式之后,为每个上载的档案找到一个编码的沥青阵列。 利用MSQ储存图像也是一种坏的想法。 See my podcast with Scott Hanselman for more info.using ImageResizer;
using ImageResizer.Encoding;
//Loop through each uploaded file
foreach (string fileKey in HttpContext.Current.Request.Files.Keys) {
HttpPostedFile file = HttpContext.Current.Request.Files[fileKey];
//You can specify any of 30 commands.. See http://imageresizing.net
ResizeSettings resizeCropSettings =
new ResizeSettings("width=200&height=200&format=jpg&crop=auto");
using (MemoryStream ms = new MemoryStream()) {
//Resize the image
ImageBuilder.Current.Build(file, ms, resizeCropSettings);
//Upload the byte array to SQL: ms.ToArray();
}
}
这是我为改变形象所做的事。
private byte[] toBytes(Image image)
{
Bitmap resized = new Bitmap(image, yourWidth, yourHeight);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
resized.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
resized.Dispose();
return ms.ToArray();
}
In my webpages I have references to js and images as such: "../../Content/Images/"Filename" In my code if I reference a file as above, it doesnt work so i have to write: "c:/miscfiles/"filename" 1-...
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...
I m looking for best practices here. Sorry. I know it s subjective, but there are a lot of smart people here, so there ought to be some "very good" ways of doing this. I have a custom object called ...
I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...
i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...
For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?
I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!