コード例 #1
0
ファイル: TransImage.svc.cs プロジェクト: lxh2014/gigade-net
 public string Trans(string sourceImgPath,string targetPath,string newFileName,int width,int height,string userName,string passWd)
 {
     string error = string.Empty;
     string targetImgPath = targetPath + newFileName;
     if (!Directory.Exists(targetPath))
         Directory.CreateDirectory(targetPath);
     ImageClass iC = new ImageClass(userName, passWd);
     iC.ImageMagick(sourceImgPath, targetImgPath, width, height, ref error);
     return error;
 }
コード例 #2
0
 /// <summary>
 /// 生成和上传图片
 /// </summary>
 /// <param name="serverPath">服务器路径</param>
 /// <param name="newFileName">新名称</param>
 /// <param name="width">新图片宽度</param>
 /// <param name="height">新图片高度</param>
 public void MakeUpLoadImg(HttpPostedFileBase file, string ftpPath, string serverPath, string sourceImgPath, string newFileName, int width, int height)
 {
     string serverFilePath = Server.MapPath(serverPath + newFileName);
     string error = string.Empty;
     if (!Directory.Exists(serverPath))
         Directory.CreateDirectory(serverPath);
     ImageClass iC = new ImageClass(sourceImgPath);
     iC.MakeThumbnail(serverFilePath, width, height, ref error);
     if (error != string.Empty)
     {
         file.SaveAs(serverFilePath);
     }
     FTP ftp = new FTP(ftpPath, ftpuser, ftppwd);
     ftp.UploadFile(serverFilePath);
 }