如何获取新的图像文件名
本文关键字:图像 文件名 获取 何获取 | 更新日期: 2023-09-27 18:33:15
我计划使用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();
}
从这里: 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
包含你需要的东西。