public void LoadPage() { if (!AjaxLoadCheck()) { return; } string msg = ""; HttpFileCollection files = HttpContext.Current.Request.Files; BaseConfig conf = ShopCache.GetBaseConfig(); B_WaterConfig bc = new B_WaterConfig(); WaterConfig mx = bc.LoadConfig(); if (files.Count > 0) { ///'检查文件扩展名字 HttpPostedFile postedFile = files[0]; string name = "icon"; string savepath = GetPath(); string fileName, fileExtension; fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); name = name + fileExtension; string ServerPath = System.Web.HttpContext.Current.Server.MapPath("/"); string fdir = ServerPath + savepath + "/icon" + fileExtension; string fdirs = ServerPath + savepath + "/icon_small" + fileExtension; if (File.Exists(fdir)) { File.Delete(fdir); } if (File.Exists(fdirs)) { File.Delete(fdirs); } int status = ImageHelper.SaveImage(postedFile, savepath, name); if (status != 290) { msg = Language.Tag(EX_Type.TypeName(status)); Response.Write("{\"msg\":\"" + msg + "\"}"); return; } string OldImage = savepath + name; //生成所有自定义规格 ImageHelper.UPLoad(OldImage, savepath, "icon_small" + fileExtension, 100, 100, "Cut"); //写入数据库 Lebi_Image model = new Lebi_Image(); model.Image = name; model.Keyid = 0; model.Size = "100,100"; model.TableName = "temp"; B_Lebi_Image.Add(model); msg = "OK"; Response.Write("{\"msg\":\"" + msg + "\",\"ImageUrl\":\"" + model.Image + "\"}"); return; } msg = Language.Tag("没有选择任何文件", ""); Response.Write("{\"msg\":\"" + msg + "\"}"); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Lebi_Image model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [Lebi_Image]("); strSql.Append("Image,TableName,Keyid,Size,Time_Update)"); strSql.Append(" values ("); strSql.Append("@Image,@TableName,@Keyid,@Size,@Time_Update)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Image", model.Image), new SqlParameter("@TableName", model.TableName), new SqlParameter("@Keyid", model.Keyid), new SqlParameter("@Size", model.Size), new SqlParameter("@Time_Update", model.Time_Update) }; object obj = SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters); if (obj == null) { return(1); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Lebi_Image model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update [Lebi_Image] set "); strSql.Append("Image= @Image,"); strSql.Append("TableName= @TableName,"); strSql.Append("Keyid= @Keyid,"); strSql.Append("Size= @Size,"); strSql.Append("Time_Update= @Time_Update"); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@Image", SqlDbType.NVarChar, 200), new SqlParameter("@TableName", SqlDbType.NVarChar, 50), new SqlParameter("@Keyid", SqlDbType.Int, 4), new SqlParameter("@Size", SqlDbType.NVarChar, 500), new SqlParameter("@Time_Update", SqlDbType.DateTime) }; parameters[0].Value = model.id; parameters[1].Value = model.Image; parameters[2].Value = model.TableName; parameters[3].Value = model.Keyid; parameters[4].Value = model.Size; parameters[5].Value = model.Time_Update; SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters); }
/// <summary> /// 对象实体绑定数据 /// </summary> public Lebi_Image ReaderBind(IDataReader dataReader) { Lebi_Image model = new Lebi_Image(); object ojb; ojb = dataReader["id"]; if (ojb != null && ojb != DBNull.Value) { model.id = (int)ojb; } model.Image = dataReader["Image"].ToString(); model.TableName = dataReader["TableName"].ToString(); ojb = dataReader["Keyid"]; if (ojb != null && ojb != DBNull.Value) { model.Keyid = (int)ojb; } model.Size = dataReader["Size"].ToString(); ojb = dataReader["Time_Update"]; if (ojb != null && ojb != DBNull.Value) { model.Time_Update = (DateTime)ojb; } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Lebi_Image model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [Lebi_Image]("); strSql.Append("[Image],[TableName],[Keyid],[Size],[Time_Update])"); strSql.Append(" values ("); strSql.Append("@Image,@TableName,@Keyid,@Size,@Time_Update)"); OleDbParameter[] parameters = { new OleDbParameter("@Image", model.Image), new OleDbParameter("@TableName", model.TableName), new OleDbParameter("@Keyid", model.Keyid), new OleDbParameter("@Size", model.Size), new OleDbParameter("@Time_Update", model.Time_Update.ToString("yyyy-MM-dd HH:mm:ss")) }; AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters); return(1); }
private string PostFiles(string fileName, string savepath, string name) { if (Shop.LebiAPI.Service.Instanse.Check("imageserver") && WebConfig.Instrance.UpLoadURL != "") { try { string url = WebConfig.Instrance.UpLoadURL; if (url.Contains("?")) { url += "&filename=" + fileName; } else { url += "?filename=" + fileName; } if (WebConfig.Instrance.ImageServerKey != "") { url += "&key=" + WebConfig.Instrance.ImageServerKey; } string res = HtmlEngine.PostFile(url, ImageHelper.rootpath(savepath + name)); //api = jss.Deserialize<LBAPI>(res); ImageHelper.DeleteImage(savepath + name); return(res); } catch (Exception ex) { return("{\"msg\":\"" + ex.Message + "\"}"); } } string OldImage = savepath + name; string size = ""; Lebi_Image model = new Lebi_Image(); model.Image = OldImage; model.Keyid = 0; model.Size = size; model.TableName = "Product"; B_Lebi_Image.Add(model); return("{\"msg\":\"OK\",\"img\":\"" + OldImage + "\",\"file\":\"" + fileName + "\"}"); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Lebi_Image model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update [Lebi_Image] set "); strSql.Append("[Image]=@Image,"); strSql.Append("[TableName]=@TableName,"); strSql.Append("[Keyid]=@Keyid,"); strSql.Append("[Size]=@Size,"); strSql.Append("[Time_Update]=@Time_Update"); strSql.Append(" where id=" + model.id); OleDbParameter[] parameters = { new OleDbParameter("@Image", model.Image), new OleDbParameter("@TableName", model.TableName), new OleDbParameter("@Keyid", model.Keyid), new OleDbParameter("@Size", model.Size), new OleDbParameter("@Time_Update", model.Time_Update.ToString("yyyy-MM-dd HH:mm:ss")) }; AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters); }
/// <summary> /// 得到一个对象实体 by id /// </summary> public Lebi_Image GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from [Lebi_Image] "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Lebi_Image model = new Lebi_Image(); DataSet ds = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } model.Image = ds.Tables[0].Rows[0]["Image"].ToString(); model.TableName = ds.Tables[0].Rows[0]["TableName"].ToString(); if (ds.Tables[0].Rows[0]["Keyid"].ToString() != "") { model.Keyid = int.Parse(ds.Tables[0].Rows[0]["Keyid"].ToString()); } model.Size = ds.Tables[0].Rows[0]["Size"].ToString(); if (ds.Tables[0].Rows[0]["Time_Update"].ToString() != "") { model.Time_Update = DateTime.Parse(ds.Tables[0].Rows[0]["Time_Update"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 得到一个对象实体 by where条件 /// </summary> public Lebi_Image GetModel(string strWhere) { if (strWhere.IndexOf("lbsql{") > 0) { SQLPara para = new SQLPara(strWhere, "", ""); return(GetModel(para)); } StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from [Lebi_Image] "); strSql.Append(" where " + strWhere + ""); Lebi_Image model = new Lebi_Image(); DataSet ds = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } model.Image = ds.Tables[0].Rows[0]["Image"].ToString(); model.TableName = ds.Tables[0].Rows[0]["TableName"].ToString(); if (ds.Tables[0].Rows[0]["Keyid"].ToString() != "") { model.Keyid = int.Parse(ds.Tables[0].Rows[0]["Keyid"].ToString()); } model.Size = ds.Tables[0].Rows[0]["Size"].ToString(); if (ds.Tables[0].Rows[0]["Time_Update"].ToString() != "") { model.Time_Update = DateTime.Parse(ds.Tables[0].Rows[0]["Time_Update"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 安全方式绑定对象表单 /// </summary> public Lebi_Image SafeBindForm(Lebi_Image model) { if (HttpContext.Current.Request["Image"] != null) { model.Image = Shop.Tools.RequestTool.RequestSafeString("Image"); } if (HttpContext.Current.Request["TableName"] != null) { model.TableName = Shop.Tools.RequestTool.RequestSafeString("TableName"); } if (HttpContext.Current.Request["Keyid"] != null) { model.Keyid = Shop.Tools.RequestTool.RequestInt("Keyid", 0); } if (HttpContext.Current.Request["Size"] != null) { model.Size = Shop.Tools.RequestTool.RequestSafeString("Size"); } if (HttpContext.Current.Request["Time_Update"] != null) { model.Time_Update = Shop.Tools.RequestTool.RequestTime("Time_Update", System.DateTime.Now); } return(model); }
public void LoadPage() { if (!AjaxLoadCheck()) { return; } string msg = ""; string name = ""; int theme_id = RequestTool.RequestInt("theme_id", 0); Lebi_Theme theme = B_Lebi_Theme.GetModel(theme_id); if (theme == null) { Response.Write("{\"msg\":\"" + Language.Tag("参数错误") + "\"}"); return; } HttpFileCollection files = HttpContext.Current.Request.Files; BaseConfig conf = ShopCache.GetBaseConfig(); B_WaterConfig bc = new B_WaterConfig(); WaterConfig mx = bc.LoadConfig(); if (files.Count > 0) { ///'检查文件扩展名字 HttpPostedFile postedFile = files[0]; string savepath = GetPath(theme.Path_Advert); string fileName, fileExtension; fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); if (conf.UpLoadSaveName == "" || conf.UpLoadSaveName == null) { conf.UpLoadSaveName = "0"; } if (conf.UpLoadSaveName == "0") { name = DateTime.Now.ToString("yyMMddssfff") + "_w$h_"; } else { name = System.IO.Path.GetFileNameWithoutExtension(fileName) + "_w$h_"; } name = conf.UpLoadRName + name + fileExtension; int status = ImageHelper.SaveImage(postedFile, savepath, name); if (status != 290) { msg = Language.Tag(EX_Type.TypeName(status)); Response.Write("{\"msg\":\"" + msg + "\"}"); return; } string OldImage = savepath + name; OldImage = ThemeUrl.CheckURL(OldImage); string ImageSmall = name.Replace("_w$h_", "_100$100_"); string size = "100$100"; ImageHelper.UPLoad(OldImage, savepath, ImageSmall, Convert.ToInt32(conf.ImageSmallWidth), Convert.ToInt32(conf.ImageSmallHeight)); //写入数据库 Lebi_Image model = new Lebi_Image(); model.Image = savepath + name; model.Keyid = 0; model.Size = size; model.TableName = "temp"; B_Lebi_Image.Add(model); msg = "OK"; Response.Write("{\"msg\":\"" + msg + "\",\"url\":\"" + savepath + name + "\",\"Image\":\"" + name + "\",\"ImageSmall\":\"" + ImageSmall + "\"}"); return; } msg = Language.Tag("没有选择任何文件", ""); Response.Write("{\"msg\":\"" + msg + "\"}"); }
private string TestUpload() { HttpFileCollection files = HttpContext.Current.Request.Files; B_WaterConfig bc = new B_WaterConfig(); WaterConfig mx = bc.LoadConfig(); BaseConfig conf = ShopCache.GetBaseConfig(); string result = ""; string name = ""; StringBuilder strMsg = new StringBuilder(); string savepath = GetPath(conf.UpLoadPath); try { for (int iFile = 0; iFile < files.Count; iFile++) { ///'检查文件扩展名字 HttpPostedFile postedFile = files[iFile]; string fileName, fileExtension; fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); if (conf.UpLoadSaveName == "" || conf.UpLoadSaveName == null) { conf.UpLoadSaveName = "0"; } if (conf.UpLoadSaveName == "0") { name = DateTime.Now.ToString("yyMMddssfff") + "_w$h_"; } else { name = System.IO.Path.GetFileNameWithoutExtension(fileName) + "_w$h_"; } name = conf.UpLoadRName + name + fileExtension; int status = ImageHelper.SaveImage(postedFile, savepath, name); if (status != 290) { continue; } if (Shop.LebiAPI.Service.Instanse.Check("imageserver") && WebConfig.Instrance.UpLoadURL != "") { try { string res = HtmlEngine.PostFile(WebConfig.Instrance.UpLoadURL, ImageHelper.rootpath(savepath + name)); JavaScriptSerializer jss = new JavaScriptSerializer(); LBAPI api = jss.Deserialize <LBAPI>(res); result = res; } catch (Exception ex) { result = "{\"msg\":\"" + ex.Message + "\"}"; } } else { string OldImage = savepath + name; //string ImageBig = name.Replace("_w$h_", "_" + conf.ImageBigWidth + "$" + conf.ImageBigHeight + "_"); //string ImageMedium = name.Replace("_w$h_", "_" + conf.ImageMediumWidth + "$" + conf.ImageMediumHeight + "_"); //string ImageSmall = name.Replace("_w$h_", "_" + conf.ImageSmallWidth + "$" + conf.ImageSmallHeight + "_"); //string size = conf.ImageBigWidth + "$" + conf.ImageBigHeight + "," + conf.ImageMediumWidth + "$" + conf.ImageMediumHeight + "," + conf.ImageSmallWidth + "$" + conf.ImageSmallHeight; //if (mx.OnAndOff == "1") //{ // ImageHelper.UPLoad(OldImage, savepath, "temp_" + name, Convert.ToInt32(conf.ImageBigWidth), Convert.ToInt32(conf.ImageBigHeight)); // ImageHelper.MakeWater(System.Web.HttpContext.Current.Server.MapPath(savepath) + "temp_" + name, savepath, ImageBig, mx); // ImageHelper.DeleteImage(savepath + "temp_" + name); //} //else //{ // ImageHelper.UPLoad(OldImage, savepath, ImageBig, Convert.ToInt32(conf.ImageBigWidth), Convert.ToInt32(conf.ImageBigHeight)); //} //ImageHelper.UPLoad(OldImage, savepath, ImageMedium, Convert.ToInt32(conf.ImageMediumWidth), Convert.ToInt32(conf.ImageMediumHeight)); //ImageHelper.UPLoad(OldImage, savepath, ImageSmall, Convert.ToInt32(conf.ImageSmallWidth), Convert.ToInt32(conf.ImageSmallHeight)); ////生成所有规格 //string where = "id not in (select id from Lebi_ImageSize where (Width=" + conf.ImageBigWidth + " and Height=" + conf.ImageBigHeight + ") or (Width=" + conf.ImageMediumWidth + " and Height=" + conf.ImageMediumHeight + ") or (Width=" + conf.ImageSmallWidth + " and Height=" + conf.ImageSmallHeight + "))"; //List<Lebi_ImageSize> ss = B_Lebi_ImageSize.GetList(where, ""); //foreach (Lebi_ImageSize s in ss) //{ // ImageHelper.UPLoad(OldImage, savepath, name.Replace("_w$h_", "_" + s.Width + "$" + s.Height + "_"), s.Width, s.Height); // size += "," + s.Width + "$" + s.Height; //} //写入数据库 Lebi_Image model = new Lebi_Image(); model.Image = savepath + name; model.Keyid = 0; model.Size = ""; model.TableName = "temp"; B_Lebi_Image.Add(model); result = "{\"img\":\"" + OldImage + "\",\"msg\":\"OK\"}"; } } } catch (System.Exception ex) { result = "{\"msg\":\"" + ex.Message + "\"}"; } return(result); }
public void LoadPage() { if (!AjaxLoadCheck()) { return; } string msg = ""; string name = ""; HttpFileCollection files = HttpContext.Current.Request.Files; BaseConfig conf = ShopCache.GetBaseConfig(); B_WaterConfig bc = new B_WaterConfig(); WaterConfig mx = bc.LoadConfig(); if (files.Count > 0) { ///'检查文件扩展名字 HttpPostedFile postedFile = files[0]; string savepath = GetPath(ShopCache.GetBaseConfig().UpLoadPath); string fileName, fileExtension; fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); if (conf.UpLoadSaveName == "" || conf.UpLoadSaveName == null) { conf.UpLoadSaveName = "0"; } if (conf.UpLoadSaveName == "0") { name = DateTime.Now.ToString("yyMMddssfff") + "_w$h_"; } else { name = System.IO.Path.GetFileNameWithoutExtension(fileName) + "_w$h_"; } if (RequestTool.RequestSafeString("path") == "verified") { name = DateTime.Now.ToString("yyMMddssfff") + "_w$h_"; } name = conf.UpLoadRName + name + fileExtension; int status = ImageHelper.SaveImage(postedFile, savepath, name); if (status != 290) { msg = Language.Tag(EX_Type.TypeName(status)); Response.Write("{\"msg\":\"" + msg + "\"}"); return; } else { //写入数据库 Lebi_Image model = new Lebi_Image(); model.Image = savepath + name; model.Keyid = 0; model.Size = ""; model.TableName = "temp"; B_Lebi_Image.Add(model); Response.Write("{\"msg\":\"OK\",\"ImageUrl\":\"" + model.Image + "\"}"); return; } } msg = Language.Tag("没有选择任何文件"); Response.Write("{\"msg\":\"" + msg + "\"}"); }
/// <summary> /// 更新一条数据 /// </summary> public static void Update(Lebi_Image model) { D_Lebi_Image.Instance.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public static int Add(Lebi_Image model) { return(D_Lebi_Image.Instance.Add(model)); }
/// <summary> /// 安全方式绑定表单数据 /// </summary> public static Lebi_Image SafeBindForm(Lebi_Image model) { return(D_Lebi_Image.Instance.SafeBindForm(model)); }
public void LoadPage() { if (!AjaxLoadCheck()) { return; } string msg = ""; string name = ""; string sizestr = "100,100"; //缩略图大小 HttpFileCollection files = HttpContext.Current.Request.Files; BaseConfig conf = ShopCache.GetBaseConfig(); B_WaterConfig bc = new B_WaterConfig(); WaterConfig mx = bc.LoadConfig(); if (files.Count > 0) { ///'检查文件扩展名字 HttpPostedFile postedFile = files[0]; string savepath = GetPath(conf.UpLoadPath); string fileName, fileExtension; fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); if (conf.UpLoadSaveName == "" || conf.UpLoadSaveName == null) { conf.UpLoadSaveName = "0"; } if (conf.UpLoadSaveName == "0") { name = DateTime.Now.ToString("yyMMddssfff") + "_w$h_"; } else { name = System.IO.Path.GetFileNameWithoutExtension(fileName) + "_w$h_"; } name = conf.UpLoadRName + name + fileExtension; int status = ImageHelper.SaveImage(postedFile, savepath, name); if (status != 290) { msg = Language.Tag(EX_Type.TypeName(status)); Response.Write("{\"msg\":\"" + msg + "\"}"); return; } string OldImage = savepath + name; string SmallImage = ""; //生成所有自定义规格 string[] sizes = sizestr.Split('$'); foreach (string ss in sizes) { string[] s = ss.Split(','); int w = Convert.ToInt32(s[0]); int h = Convert.ToInt32(s[1]); SmallImage = name.Replace("_w$h_", "_" + w + "$" + h + "_"); ImageHelper.UPLoad(OldImage, savepath, SmallImage, w, h); } SmallImage = savepath + SmallImage; //写入数据库 Lebi_Image model = new Lebi_Image(); model.Image = savepath + name; model.Keyid = 0; model.Size = sizestr; model.TableName = "temp"; B_Lebi_Image.Add(model); msg = "OK"; Response.Write("{\"msg\":\"" + msg + "\",\"ImageSmall\":\"" + SmallImage + "\",\"ImageUrl\":\"" + model.Image + "\"}"); return; } msg = Language.Tag("没有选择任何文件", ""); Response.Write("{\"msg\":\"" + msg + "\"}"); }
public void LoadPage() { if (!AjaxLoadCheck()) { return; } string msg = ""; string name = ""; HttpFileCollection files = HttpContext.Current.Request.Files; BaseConfig conf = ShopCache.GetBaseConfig(); B_WaterConfig bc = new B_WaterConfig(); WaterConfig mx = bc.LoadConfig(); if (files.Count > 0) { ///'检查文件扩展名字 HttpPostedFile postedFile = files[0]; string savepath = GetPath(conf.UpLoadPath); string fileName, fileExtension; fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); if (conf.UpLoadSaveName == "" || conf.UpLoadSaveName == null) { conf.UpLoadSaveName = "0"; } if (conf.UpLoadSaveName == "0") { name = DateTime.Now.ToString("yyMMddssfff") + "_w$h_"; } else { name = System.IO.Path.GetFileNameWithoutExtension(fileName) + "_w$h_"; } name = conf.UpLoadRName + name + fileExtension; int status = ImageHelper.SaveImage(postedFile, savepath, name); if (status != 290) { msg = Language.Tag(EX_Type.TypeName(status)); Response.Write("{\"msg\":\"" + msg + "\"}"); return; } if (Shop.LebiAPI.Service.Instanse.Check("imageserver") && WebConfig.Instrance.UpLoadURL != "") { try { string url = WebConfig.Instrance.UpLoadURL; if (url.Contains("?")) { url += "&filename=" + fileName; } else { url += "?filename=" + fileName; } if (WebConfig.Instrance.ImageServerKey != "") { url += "&key=" + WebConfig.Instrance.ImageServerKey; } string res = HtmlEngine.PostFile(url, ImageHelper.rootpath(savepath + name)); //api = jss.Deserialize<LBAPI>(res); ImageHelper.DeleteImage(savepath + name); Response.Write(res); } catch (Exception ex) { Response.Write("{\"msg\":\"" + ex.Message + "\"}"); } return; } string OldImage = savepath + name; //string ImageBig = name.Replace("_w$h_", "_" + conf.ImageBigWidth + "$" + conf.ImageBigHeight + "_"); //string ImageMedium = name.Replace("_w$h_", "_" + conf.ImageMediumWidth + "$" + conf.ImageMediumHeight + "_"); //string ImageSmall = name.Replace("_w$h_", "_" + conf.ImageSmallWidth + "$" + conf.ImageSmallHeight + "_"); //string size = conf.ImageBigWidth + "$" + conf.ImageBigHeight + "," + conf.ImageMediumWidth + "$" + conf.ImageMediumHeight + "," + conf.ImageSmallWidth + "$" + conf.ImageSmallHeight; string size = ""; //if (mx.OnAndOff == "1") //{ // ImageHelper.UPLoad(OldImage, savepath, "temp_" + name, Convert.ToInt32(conf.ImageBigWidth), Convert.ToInt32(conf.ImageBigHeight)); // ImageHelper.MakeWater(System.Web.HttpContext.Current.Server.MapPath(savepath) + "temp_" + name, savepath, ImageBig, mx); // ImageHelper.DeleteImage(savepath + "temp_" + name); //} //else //{ // ImageHelper.UPLoad(OldImage, savepath, ImageBig, Convert.ToInt32(conf.ImageBigWidth), Convert.ToInt32(conf.ImageBigHeight)); //} //ImageHelper.UPLoad(OldImage, savepath, ImageMedium, Convert.ToInt32(conf.ImageMediumWidth), Convert.ToInt32(conf.ImageMediumHeight)); //ImageHelper.UPLoad(OldImage, savepath, ImageSmall, Convert.ToInt32(conf.ImageSmallWidth), Convert.ToInt32(conf.ImageSmallHeight)); ////生成所有规格 //string where = "id not in (select id from Lebi_ImageSize where (Width=" + conf.ImageBigWidth + " and Height=" + conf.ImageBigHeight + ") or (Width=" + conf.ImageMediumWidth + " and Height=" + conf.ImageMediumHeight + ") or (Width=" + conf.ImageSmallWidth + " and Height=" + conf.ImageSmallHeight + "))"; //List<Lebi_ImageSize> ss = B_Lebi_ImageSize.GetList(where, ""); //foreach (Lebi_ImageSize s in ss) //{ // ImageHelper.UPLoad(OldImage, savepath, name.Replace("_w$h_", "_" + s.Width + "$" + s.Height + "_"), s.Width, s.Height); // size += "," + s.Width + "$" + s.Height; //} //写入数据库 Lebi_Image model = new Lebi_Image(); model.Image = OldImage; model.Keyid = 0; model.Size = size; model.TableName = "Product"; B_Lebi_Image.Add(model); msg = "OK"; Response.Write("{\"msg\":\"" + msg + "\",\"img\":\"" + OldImage + "\",\"file\":\"" + fileName + "\"}"); return; } msg = Language.Tag("没有选择任何文件", ""); Response.Write("{\"msg\":\"" + msg + "\"}"); }