1

我计划使用 ImageResizer 将图像存储在文件系统上,并将图像 URL 存储在数据库中。我一遍又一遍地浏览 API,但找不到明显的方法来获取新创建的文件名以包含在 DB URL 中:

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.

    ImageJob i = new ImageJob(file, "~/eventimages/<guid>_<filename:A-Za-z0-9>.<ext>", 
        new ResizeSettings("width=200&height=133&format=jpg&crop=auto"));
    i.Build();
}
4

1 回答 1

3

从这里: http: //nathanaeljones.github.com/resizer-docs/doxygen/class_image_resizer_1_1_image_job.html

string  FinalPath [get, set]
        Contains the final physical path to the image (if 'dest' was a path - null otherwise) 

考虑到dest你的路径,我想FinalPath包含你需要的东西。

于 2012-05-05T23:41:52.433 回答