Beispiel #1
0
        /// <summary>
        /// 用户修改头像
        /// </summary>
        /// <param name="model">修改模型</param>
        public void ModifyUserHead(ModifyUserHeadModel model)
        {
            IRepository <Account> accountRep = Factory.Factory <IRepository <Account> > .GetConcrete <Account>();

            Account usr = accountRep.GetByKey(model.UserID);

            string subDir = System.DateTime.Now.ToString("yyyyMMdd");

            //生成两种尺寸头像
            //ImageResizer ir = new ImageResizer("~/usrimg/", "~/usrimg/"+subDir+"/");
            PanoramaCutting pc   = new PanoramaCutting("~/usrimg/", "~/usrimg/" + subDir + "/");
            string          head = pc.GetImage(model.UserHead, 172, 124);
            string          tiny = pc.GetImage(model.UserHead, 50, 50);

            //可能会再加入回复框中显示的标准,即第三种情况

            //Utils.Tools.CreateThumbForFile("~/usrimg/"+subDir+"/"+Guid.NewGuid().ToString().Replace('-',''),);
            //修改头像
            usr.AccountMsgVO = new
                               AccountMessageVO(
                model.UserID,
                usr.UserName,
                subDir + "/" + head,
                subDir + "" + tiny,
                usr.Points);

            //usr.UserHead = subDir +"/"+ head;
            //usr.Tiny = subDir +"/"+ tiny;

            //更新
            accountRep.Update(usr);
            accountRep.PersistAll();
        }
Beispiel #2
0
        public string GetArticleImageTiny(string ImgName)
        {
            PanoramaCutting ir = new PanoramaCutting("~/FLYUpload/Images/", "~/FLYUpload/Images/TinyImages/");

            return(ir.GetImage(ImgName, 50, 50));
        }