mvc3 ImageResizer

前端 未结 1 2006
轻奢々
轻奢々 2021-01-26 12:31

I downloaded the Nugent ImageResizer and I am trying to resize a picture on upload following an example on this page http://imageresizing.net/docs/managed but I can\'t seen to p

相关标签:
1条回答
  • 2021-01-26 13:13

    ImageResizer should be given the uploaded file and the output path directly

    ImageResizer supports both GUIDs and path sanitization. NEVER use the uploaded filename as-is!

    var i = new ImageJob(file, 
                        "~/uploads/profilepic/<guid>_<filename:A-Za-z0-9>.<ext>", 
                         new ResizeSettings("width=130&height=130&format=jpg"));
    i.CreateParentDirectory = true; //Auto-create the uploads directory.
    i.Build();
    
    var newVirtualPath = ImageResizer.Util.PathUtils.GuessVirtualPath(i.FinalPath);
    
    0 讨论(0)
提交回复
热议问题