Example #1
0
        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();
        }