小编Nic*_*ick的帖子

HttpContext.Current没有在MVC 4项目中解析

我想使用ImageResizer(来自ImageResizing dot net).我通过NuGet为MVC安装了ImageResizer.但是当我从示例中使用以下代码时:

//Loop through each uploaded file
foreach (string fileKey in HttpContext.Current.Request.Files.Keys)
{
    HttpPostedFile file = HttpContext.Current.Request.Files[fileKey];
    if (file.ContentLength <= 0) continue; //Skip unused file controls.

    //The resizing settings can specify any of 30 commands.. See http://imageresizing.net for details.
    //Destination paths can have variables like <guid> and <ext>, or 
    //even a santizied version of the original filename, like <filename:A-Za-z0-9>
    ImageResizer.ImageJob i = new ImageResizer.ImageJob(file, "~/uploads/<guid>.<ext>", new ImageResizer.ResizeSettings(
                            "width=2000;height=2000;format=jpg;mode=max"));
    i.CreateParentDirectory = true; //Auto-create the uploads directory.
    i.Build();
}
Run Code Online (Sandbox Code Playgroud)

foreach中的"HttpContext.Current.Request.Files.Keys"是不是正在解决?我的用法正确,Visual Studio不提供"Resolve"选项.

c# asp.net asp.net-mvc httpcontext asp.net-mvc-4

34
推荐指数
2
解决办法
4万
查看次数

检索 UIImage 的 PHAsset localIdentifier

目标:让用户选择照片,应用程序将通过在 Core Data 中存储 PHAsset.localIdentifier 来存储/检索/删除对这些图像的引用。

我成功地从照片中检索 PHAssets,访问图像和本地标识符。还成功地将 localIdentifier 存储在 Core Data 中。问题是当我需要根据涉及相关图像的某些用户活动更新/删除包含 localIdentifier 的核心数据记录时,我无法“反向查找”与图像关联的原始 localIdentifier。

有没有办法做到这一点?或者我是否必须使用自定义构造来存储 localIdentifier 和图像,以便我可以在需要时将它们关联起来。UIImage 有一个 imageAsset?不确定这是否会以某种方式有用。

uiimagepickercontroller uiimage swift

5
推荐指数
0
解决办法
602
查看次数