3
如何獲取上傳圖像(IFormFile
)的文件流並調整其大小?ASP.NET核心圖像上傳和調整
public ActionResult Upload(IFormFile file)
{
using (var reader = new StreamReader(file.OpenReadStream()))
{
var fileContent = reader.ReadToEnd();
var parsedContentDisposition = ContentDispositionHeaderValue.Parse(file.ContentDisposition);
//scale image here?
}
}
這將工作,如果它的目標是完整的框架,而不僅僅是核心。我可能是錯的,但我認爲還沒有辦法在覈心中操縱圖像。 http://www.hanselman.com/blog/RFCServersideImageAndGraphicsProcessingWithNETCoreAndASPNET5.aspx(有足夠的東西遺漏給我,因爲這樣的原因我瞄準了4.6庫)。 –
asp.net-core和asp.net 5暫時是在stackoverflow上的臨時同義詞;不過,爲了清楚起見,我會更新標籤以包含asp.net。我正在談論完整的框架(4.6和核心)。謝謝! –
有道理。 ;-) –