我计划使用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();
}
答案 0 :(得分: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
包含您需要的内容。