DTcms.Web.UI/UpLoad.cs
(开头部分) 11KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections;
using System.Web;
using System.IO;
using System.Drawing;
using System.Net;
using System.Configuration;
using DTcms.Common;
namespace DTcms.Web.UI
{
public class UpLoad
{
private Model.siteconfig siteConfig;
public UpLoad()
{
siteConfig = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath("Configpath"));
}
/// <summary>
/// 裁剪图片并保存
/// </summary>
public bool cropSaveAs(string fileName, string newFileName, int maxWidth, int maxHeight, int cropWidth, int cropHeight, int X, int Y)
{
string fileExt = Utils.GetFileExt(fileName); //文件扩展名,不含“.”
if (!IsImage(fileExt))
{
return false;
}
string newFileDir = Utils.GetMapPath(newFileName.Substring(0, newFileName.LastIndexOf(@"/") + 1));
//检查是否有该路径,没有则创建
if (!Directory.Exists(newFileDir))
{
Directory.CreateDirectory(newFileDir);
}
try
{
string fileFullPath = Utils.GetMapPath(fileName);
string toFileFullPath = Utils.GetMapPath(newFileName);
return Thumbnail.MakeThumbnailImage(fileFullPath, toFileFullPath, 180, 180, cropWidth, cropHeight, X, Y);
}
catch
{
return false;
}
}
/// <summary>
/// 文件上传方法A
/// </summary>
/// <param name="postedFile">文件流</param>
/// <param name="isThumbnail">是否生成缩略图</param>
/// <param name="isWater">是否打水印</param>
/// <returns>服务器文件路径</returns>
public string fileSaveAs(HttpPostedFile postedFile, bool isThumbnail, bool isWater)
{
return fileSaveAs(postedFile, isThumbnail, isWater, false, false);
}
后面还有 218 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
