private void setAvatar() { Upload.Avatar myAvatar = new Upload.Avatar(); Information.topic myTopic = new Information.topic(); Hashtable picInfo = new Hashtable(); int pid = Convert.ToInt32(theContext.Request.Form["pid"]); string newFileName = "A_" + System.Guid.NewGuid().ToString("N") + "_A" + pid + ".jpg"; string folderPath=System.DateTime.Now.Year + "/" + System.DateTime.Now.Month + "/" + System.DateTime.Now.Day + "/"; string savePath = HttpContext.Current.Server.MapPath("~/upload/userImages/" + folderPath); picInfo = myTopic.getPostImgByPid(pid); Images.MakeThumbnail(picInfo["img"].ToString(), savePath+newFileName, 320, 320, "Cut"); myAvatar.newUpload(Convert.ToInt32(theContext.Session["id"]), 0, 0, 320, 320, "/upload/userImages/" + folderPath + newFileName); addPicPostIntroduce(); }
private void avatarUpBack() { string img = theContext.Request.Form["img"]; int x1 =Convert .ToInt32( theContext.Request.Form["x1"]); int y1 = Convert.ToInt32( theContext.Request.Form["y1"]); int x2 = Convert.ToInt32( theContext.Request.Form["x2"]); int y2 = Convert.ToInt32(theContext.Request.Form["y2"]); int height = Convert.ToInt32(theContext.Request.Form["height"]); int width = Convert.ToInt32(theContext.Request.Form["width"]); Upload.Avatar myAvatar = new Upload.Avatar(); theContext.Response.Write ( myAvatar.newUpload(Convert.ToInt32(theContext.Session["id"]), x1, y1, height, width,img)); }