【发布时间】:2021-07-21 18:18:00
【问题描述】:
我正在尝试在我的项目的特定目录中添加个人资料图片:~Images/ProfilePicture
_context.People.Add(person);
_context.SaveChanges();
if (person.ProfilePicture != null)
{
string[] photoName = person.ProfilePicture.FileName.Split('.');
var imageName = $"{person.PersonId}.{photoName[photoName.Length - 1]}";
string uploaded = Path.Combine("~Images", "ProfilePicturePerson");
string filepath = Path.Combine(uploaded, imageName);
//return MagickImage
var profilePic = ImageStuff.HandleImage(person.ProfilePicture);
//error
profilePic.Write(imageName);
person.ProfilePictureName = filepath;
}
_context.SaveChanges();
我希望MagickImage.write函数在指定目录下创建文件,而不是在项目主目录下创建图片
【问题讨论】:
标签: c# asp.net-core .net-core imagemagick