类名:Upload

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.Util; namespace Tools
{
/// <summary>
/// UploadPic 的摘要说明。
/// </summary>
public class UploadPic
{
#region 构造函数
public UploadPic()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
#endregion
#region 上传图片,并生成缩略图
public string upload(System.Web.UI.HtmlControls.HtmlInputFile UploadFile, int tWidth, int tHeight)
{
string result = "";
//检查上传文件的格式是否有效
if(UploadFile.PostedFile.ContentType.ToLower().IndexOf("image") < )
{
result = "上传图片格式无效!";
return result;
} //生成原图
Byte[] oFileByte = new byte[UploadFile.PostedFile.ContentLength];
System.IO.Stream oStream = UploadFile.PostedFile.InputStream;
System.Drawing.Image oImage = System.Drawing.Image.FromStream(oStream); int oWidth = oImage.Width; //原图宽度
int oHeight = oImage.Height; //原图高度
if(oWidth < tWidth && oHeight < tHeight)
{
result = "smaller";
return result;
}
//按比例计算出缩略图的宽度和高度
if(oWidth >= oHeight)
{
tHeight = (int)Math.Floor(Convert.ToDouble(oHeight) * (Convert.ToDouble(tWidth) / Convert.ToDouble(oWidth)));
}
else
{
tWidth = (int)Math.Floor(Convert.ToDouble(oWidth) * (Convert.ToDouble(tHeight) / Convert.ToDouble(oHeight)));
} //生成缩略原图
Bitmap tImage = new Bitmap(tWidth, tHeight);
Graphics g = Graphics.FromImage(tImage);
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High; //设置高质量插值法
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;//设置高质量,低速度呈现平滑程度
g.Clear(Color.Transparent); //清空画布并以透明背景色填充
g.DrawImage(oImage, new Rectangle(, , tWidth, tHeight), new Rectangle(, , oWidth, oHeight), GraphicsUnit.Pixel);
string file = DateTime.Now.ToShortDateString().Replace("-", "").Replace("/", "").Replace("/", "") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + ".jpg";
string oFullName = System.Web.HttpContext.Current.Server.MapPath("../../UploadImg/") + file;//保存原图的物理路径
string tFullName = System.Web.HttpContext.Current.Server.MapPath("../../UploadImg/") + file; //保存缩略图的物理路径
result = file;
try
{
//以JPG格式保存图片
oImage.Save(oFullName, System.Drawing.Imaging.ImageFormat.Jpeg);
tImage.Save(tFullName, System.Drawing.Imaging.ImageFormat.Jpeg);
}
catch(Exception ex)
{
throw ex;
}
finally
{
//释放资源
oImage.Dispose();
g.Dispose();
tImage.Dispose(); }
return result;
}
public string uploadPNGSIZE(System.Web.UI.HtmlControls.HtmlInputFile UploadFile, int tWidth, int tHeight)
{
string result = "";
//检查上传文件的格式是否有效
if(UploadFile.PostedFile.ContentType.ToLower().IndexOf("image") < )
{
result = "上传图片格式无效!";
return result;
} //生成原图
Byte[] oFileByte = new byte[UploadFile.PostedFile.ContentLength];
System.IO.Stream oStream = UploadFile.PostedFile.InputStream;
System.Drawing.Image oImage = System.Drawing.Image.FromStream(oStream); int oWidth = oImage.Width; //原图宽度
int oHeight = oImage.Height; //原图高度
if(oWidth < tWidth && oHeight < tHeight)
{
result = "smaller";
return result;
}
//按比例计算出缩略图的宽度和高度
if(oWidth >= oHeight)
{
tHeight = (int)Math.Floor(Convert.ToDouble(oHeight) * (Convert.ToDouble(tWidth) / Convert.ToDouble(oWidth)));
}
else
{
tWidth = (int)Math.Floor(Convert.ToDouble(oWidth) * (Convert.ToDouble(tHeight) / Convert.ToDouble(oHeight)));
} //生成缩略原图
Bitmap tImage = new Bitmap(tWidth, tHeight);
Graphics g = Graphics.FromImage(tImage);
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High; //设置高质量插值法
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;//设置高质量,低速度呈现平滑程度
g.Clear(Color.Transparent); //清空画布并以透明背景色填充
g.DrawImage(oImage, new Rectangle(, , tWidth, tHeight), new Rectangle(, , oWidth, oHeight), GraphicsUnit.Pixel);
string file = DateTime.Now.ToShortDateString().Replace("-", "").Replace("/", "").Replace("/", "") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + ".jpg";
string oFullName = System.Web.HttpContext.Current.Server.MapPath("../../images/") + file;//保存原图的物理路径
string tFullName = System.Web.HttpContext.Current.Server.MapPath("../../images/") + file; //保存缩略图的物理路径
result = file;
try
{
//以JPG格式保存图片
oImage.Save(oFullName, System.Drawing.Imaging.ImageFormat.Png);
tImage.Save(tFullName, System.Drawing.Imaging.ImageFormat.Png);
}
catch(Exception ex)
{
throw ex;
}
finally
{
//释放资源
oImage.Dispose();
g.Dispose();
tImage.Dispose(); }
return result;
} #endregion public string upload_watermark(System.Web.UI.HtmlControls.HtmlInputFile UploadFile, int tWidth, int tHeight)
{
string filetype = System.IO.Path.GetExtension(UploadFile.PostedFile.FileName);
string result = "";
//检查上传文件的格式是否有效
if(UploadFile.PostedFile.ContentType.ToLower().IndexOf("image") < )
{
result = "上传图片格式无效!";
return result;
} //生成原图
Byte[] oFileByte = new byte[UploadFile.PostedFile.ContentLength];
System.IO.Stream oStream = UploadFile.PostedFile.InputStream;
System.Drawing.Image oImage = System.Drawing.Image.FromStream(oStream);
//加水印
System.Drawing.Image copyImage = System.Drawing.Image.FromFile(System.Web.HttpContext.Current.Server.MapPath("../../UploadImg/") + "watermark.png");
Graphics g_water = Graphics.FromImage(oImage);
g_water.DrawImage(copyImage, new Rectangle(oImage.Width - copyImage.Width, , copyImage.Width, copyImage.Height), , , copyImage.Width, copyImage.Height, GraphicsUnit.Pixel);
g_water.Dispose(); int oWidth = oImage.Width; //原图宽度
int oHeight = oImage.Height; //原图高度
if(oWidth < tWidth && oHeight < tHeight)
{
result = "smaller";
return result;
}
//按比例计算出缩略图的宽度和高度
if(oWidth >= oHeight)
{
tHeight = (int)Math.Floor(Convert.ToDouble(oHeight) * (Convert.ToDouble(tWidth) / Convert.ToDouble(oWidth)));
}
else
{
tWidth = (int)Math.Floor(Convert.ToDouble(oWidth) * (Convert.ToDouble(tHeight) / Convert.ToDouble(oHeight)));
} //生成缩略原图
Bitmap tImage = new Bitmap(tWidth, tHeight);
Graphics g = Graphics.FromImage(tImage);
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High; //设置高质量插值法
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;//设置高质量,低速度呈现平滑程度
g.Clear(Color.Transparent); //清空画布并以透明背景色填充
g.DrawImage(oImage, new Rectangle(, , tWidth, tHeight), new Rectangle(, , oWidth, oHeight), GraphicsUnit.Pixel);
string file = DateTime.Now.ToShortDateString().Replace("-", "").Replace("/", "").Replace("/", "") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + filetype;
string oFullName = System.Web.HttpContext.Current.Server.MapPath("../../UploadImg/") + file;//保存原图的物理路径
string tFullName = System.Web.HttpContext.Current.Server.MapPath("../../UploadImg/") + file; //保存缩略图的物理路径
result = file;
try
{
//以不同格式保存图片
if(filetype.Trim().ToLower().CompareTo(".png") == )
{
oImage.Save(oFullName, System.Drawing.Imaging.ImageFormat.Png);
tImage.Save(tFullName, System.Drawing.Imaging.ImageFormat.Png);
}
else
{
oImage.Save(oFullName, System.Drawing.Imaging.ImageFormat.Jpeg);
tImage.Save(tFullName, System.Drawing.Imaging.ImageFormat.Jpeg);
} }
catch(Exception ex)
{
throw ex;
}
finally
{
//释放资源
oImage.Dispose();
g.Dispose();
tImage.Dispose(); }
return result;
}
public string upload_watermark_origin(System.Web.UI.HtmlControls.HtmlInputFile UploadFile)
{
int tWidth = , tHeight = ;
string filetype = System.IO.Path.GetExtension(UploadFile.PostedFile.FileName);
string result = "";
//检查上传文件的格式是否有效
if(UploadFile.PostedFile.ContentType.ToLower().IndexOf("image") < )
{
result = "上传图片格式无效!";
return result;
} //生成原图
Byte[] oFileByte = new byte[UploadFile.PostedFile.ContentLength];
System.IO.Stream oStream = UploadFile.PostedFile.InputStream;
System.Drawing.Image oImage = System.Drawing.Image.FromStream(oStream);
//加水印
System.Drawing.Image copyImage = System.Drawing.Image.FromFile(System.Web.HttpContext.Current.Server.MapPath("../../UploadImg/") + "watermark.png");
Graphics g_water = Graphics.FromImage(oImage);
g_water.DrawImage(copyImage, new Rectangle(oImage.Width - copyImage.Width, , copyImage.Width, copyImage.Height), , , copyImage.Width, copyImage.Height, GraphicsUnit.Pixel);
g_water.Dispose(); int oWidth = oImage.Width; //原图宽度
tWidth = oWidth;
int oHeight = oImage.Height; //原图高度
tHeight = oHeight; if(oWidth < tWidth && oHeight < tHeight)
{
result = "smaller";
return result;
}
//按比例计算出缩略图的宽度和高度
if(oWidth >= oHeight)
{
tHeight = (int)Math.Floor(Convert.ToDouble(oHeight) * (Convert.ToDouble(tWidth) / Convert.ToDouble(oWidth)));
}
else
{
tWidth = (int)Math.Floor(Convert.ToDouble(oWidth) * (Convert.ToDouble(tHeight) / Convert.ToDouble(oHeight)));
} //生成缩略原图
Bitmap tImage = new Bitmap(tWidth, tHeight);
Graphics g = Graphics.FromImage(tImage);
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High; //设置高质量插值法
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;//设置高质量,低速度呈现平滑程度
g.Clear(Color.Transparent); //清空画布并以透明背景色填充
g.DrawImage(oImage, new Rectangle(, , tWidth, tHeight), new Rectangle(, , oWidth, oHeight), GraphicsUnit.Pixel);
string file = DateTime.Now.ToShortDateString().Replace("-", "").Replace("/", "").Replace("/", "") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + filetype;
string oFullName = System.Web.HttpContext.Current.Server.MapPath("../../UploadImg/") + file;//保存原图的物理路径
string tFullName = System.Web.HttpContext.Current.Server.MapPath("../../UploadImg/") + file; //保存缩略图的物理路径
result = file;
try
{
//以不同格式保存图片
if(filetype.Trim().ToLower().CompareTo(".png") == )
{
oImage.Save(oFullName, System.Drawing.Imaging.ImageFormat.Png);
tImage.Save(tFullName, System.Drawing.Imaging.ImageFormat.Png);
}
else
{
oImage.Save(oFullName, System.Drawing.Imaging.ImageFormat.Jpeg);
tImage.Save(tFullName, System.Drawing.Imaging.ImageFormat.Jpeg);
} }
catch(Exception ex)
{
throw ex;
}
finally
{
//释放资源
oImage.Dispose();
g.Dispose();
tImage.Dispose(); }
return result;
} #region 上传图片
public string uploadDirect(System.Web.UI.HtmlControls.HtmlInputFile UploadFile)
{
string filetype = System.IO.Path.GetExtension(UploadFile.PostedFile.FileName);
string result = "";
//检查上传文件的格式是否有效
if(UploadFile.PostedFile.ContentType.ToLower().IndexOf("image") >= )
{
if(UploadFile.PostedFile.ContentType.ToLower().IndexOf("image") < )
{
result = "上传图片格式无效!";
return result;
} //生成原图
System.IO.Stream oStream = UploadFile.PostedFile.InputStream; System.Drawing.Image oImage = System.Drawing.Image.FromStream(oStream);
string file = DateTime.Now.ToShortDateString().Replace("-", "").Replace("/", "") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + filetype;
string oFullName = System.Web.HttpContext.Current.Server.MapPath("../../UploadImg/") + file;//保存原图的物理路径
result = file;
try
{
//以不同格式保存图片
if(filetype.Trim().ToLower().CompareTo(".png") == )
{
oImage.Save(oFullName, System.Drawing.Imaging.ImageFormat.Png);
}
else
{
oImage.Save(oFullName, System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
catch(Exception ex)
{
//抛出异常
throw ex;
}
finally
{
//释放资源
oImage.Dispose(); }
}
else
{
string file = DateTime.Now.ToShortDateString().Replace("-", "").Replace("/", "") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + filetype;
string oFullName = System.Web.HttpContext.Current.Server.MapPath("../../file/") + file;//保存原图的物理路径
result = file;
UploadFile.PostedFile.SaveAs(oFullName);
}
return result;
}
public string uploadArticle(System.Web.UI.HtmlControls.HtmlInputFile UploadFile)
{
string filetype = System.IO.Path.GetExtension(UploadFile.PostedFile.FileName);
string result = "";
//检查上传文件的格式是否有效
if(UploadFile.PostedFile.ContentType.ToLower().IndexOf("image") >= )
{
if(UploadFile.PostedFile.ContentType.ToLower().IndexOf("image") < )
{
result = "上传图片格式无效!";
return result;
} //生成原图
System.IO.Stream oStream = UploadFile.PostedFile.InputStream; System.Drawing.Image oImage = System.Drawing.Image.FromStream(oStream);
string file = DateTime.Now.ToShortDateString().Replace("-", "").Replace("/", "") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + filetype;
string oFullName = System.Web.HttpContext.Current.Server.MapPath("../../UploadImg/") + file;//保存原图的物理路径
result = file;
try
{
//以不同格式保存图片
if(filetype.Trim().ToLower().CompareTo(".png") == )
{
oImage.Save(oFullName, System.Drawing.Imaging.ImageFormat.Png);
}
else
{
oImage.Save(oFullName, System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
catch(Exception ex)
{
throw ex;
}
finally
{
//释放资源
oImage.Dispose(); }
}
else
{
string file = DateTime.Now.ToShortDateString().Replace("-", "").Replace("/", "") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + filetype;
string oFullName = System.Web.HttpContext.Current.Server.MapPath("File/") + file;//保存原图的物理路径
result = file;
UploadFile.PostedFile.SaveAs(oFullName);
}
return result;
} public string uploadDirectWeb(System.Web.UI.WebControls.FileUpload UploadFile)
{
string filetype = System.IO.Path.GetExtension(UploadFile.PostedFile.FileName);
string result = "";
//检查上传文件的格式是否有效
if(UploadFile.PostedFile.ContentType.ToLower().IndexOf("pdf") < )
{
if(UploadFile.PostedFile.ContentType.ToLower().IndexOf("image") < )
{
result = "上传图片格式无效!";
return result;
} //生成原图
System.IO.Stream oStream = UploadFile.PostedFile.InputStream; System.Drawing.Image oImage = System.Drawing.Image.FromStream(oStream);
string file = DateTime.Now.ToShortDateString().Replace("-", "").Replace("/", "") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + filetype;
string oFullName = System.Web.HttpContext.Current.Server.MapPath("../../UploadImg/") + file;//保存原图的物理路径
result = file;
try
{
//以不同格式保存图片
if(filetype.Trim().ToLower().CompareTo(".png") == )
{
oImage.Save(oFullName, System.Drawing.Imaging.ImageFormat.Png);
}
else
{
oImage.Save(oFullName, System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
catch(Exception ex)
{
throw ex;
}
finally
{
//释放资源
oImage.Dispose(); }
}
else
{
string file = DateTime.Now.ToShortDateString().Replace("-", "").Replace("/", "") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + ".pdf";
string oFullName = System.Web.HttpContext.Current.Server.MapPath("../../file/") + file;//保存原图的物理路径
result = file;
UploadFile.PostedFile.SaveAs(oFullName);
}
return result;
}
public string uploadPNG(System.Web.UI.HtmlControls.HtmlInputFile UploadFile)
{
string filetype = System.IO.Path.GetExtension(UploadFile.PostedFile.FileName);
string result = "";
//检查上传文件的格式是否有效
if(UploadFile.PostedFile.ContentType.ToLower().IndexOf("pdf") < )
{
if(UploadFile.PostedFile.ContentType.ToLower().IndexOf("image") < )
{
result = "上传图片格式无效!";
return result;
} //生成原图
System.IO.Stream oStream = UploadFile.PostedFile.InputStream; System.Drawing.Image oImage = System.Drawing.Image.FromStream(oStream);
string file = DateTime.Now.ToShortDateString().Replace("-", "").Replace("/", "") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + filetype;
string oFullName = System.Web.HttpContext.Current.Server.MapPath("../../UploadImg/") + file;//保存原图的物理路径
result = file;
try
{
//以JPG格式保存图片
oImage.Save(oFullName, System.Drawing.Imaging.ImageFormat.Png);
}
catch(Exception ex)
{
throw ex;
}
finally
{
//释放资源
oImage.Dispose(); }
}
else
{
string file = DateTime.Now.ToShortDateString().Replace("-", "").Replace("/", "") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + ".pdf";
string oFullName = System.Web.HttpContext.Current.Server.MapPath("../../file/") + file;//保存原图的物理路径
result = file;
UploadFile.PostedFile.SaveAs(oFullName);
}
return result;
}
public string uploadFlv(System.Web.UI.HtmlControls.HtmlInputFile UploadFile)
{
string result = "";
//检查上传文件的格式是否有效
string file = DateTime.Now.ToShortDateString().Replace("-", "").Replace("/", "") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + ".flv";
string oFullName = System.Web.HttpContext.Current.Server.MapPath("../../file/") + file;//保存文件的物理路径
result = file;
UploadFile.PostedFile.SaveAs(oFullName);
return result;
}
public string uploadFile(System.Web.UI.HtmlControls.HtmlInputFile UploadFile)
{
string filetype = System.IO.Path.GetExtension(UploadFile.PostedFile.FileName);
string result = "";
string file = DateTime.Now.ToShortDateString().Replace("-", "").Replace("/", "") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + filetype;
string oFullName = System.Web.HttpContext.Current.Server.MapPath("../../file/") + file;//保存文件的物理路径
result = file;
UploadFile.PostedFile.SaveAs(oFullName);
return result;
}
public string uploadProjectFile(System.Web.UI.HtmlControls.HtmlInputFile UploadFile, string filename)
{
string filetype = System.IO.Path.GetExtension(UploadFile.PostedFile.FileName);
string result = "";
string file = filename + "_" + DateTime.Now.ToShortDateString().Replace("-", "").Replace("/", "") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + filetype;
string oFullName = System.Web.HttpContext.Current.Server.MapPath("../../file/") + file;//保存文件的物理路径
result = file;
UploadFile.PostedFile.SaveAs(oFullName);
return result;
} public string uploadAdvertisement(System.Web.UI.HtmlControls.HtmlInputFile UploadFile, string filename)
{
string filetype = System.IO.Path.GetExtension(UploadFile.PostedFile.FileName);
string result = "";
if(filetype.Trim().CompareTo(".flv") != )
{
result = "wrongformat";
}
else
{
string file = filename + filetype;
string oFullName = System.Web.HttpContext.Current.Server.MapPath("../../flash/") + file;//保存文件的物理路径
result = file;
UploadFile.PostedFile.SaveAs(oFullName);
}
return result;
}
#endregion }
}

【.NET】上传文件,生成缩略图的更多相关文章

  1. yii php 图片上传与生成缩略图

    今天需要做图片上传与生成缩略图的功能,把代码进行记录如下: html 视图              ($pic_action_url = $this->createAbsoluteUrl('h ...

  2. tp3.2 自带的文件上传及生成缩略图功能

    public function upload_file($file_name,$width,$height) { //检查图片尺寸是否合法 $image_size = getimagesize($_F ...

  3. spring boot:实现图片文件上传并生成缩略图(spring boot 2.3.1)

    一,为什么要给图片生成缩略图? 1, 用户上传的原始图片如果太大,不能直接展示在网站页面上, 因为不但流费server的流量,而且用户打开时非常费时间, 所以要生成缩略图. 2,服务端管理图片要注意的 ...

  4. Office文件上传自动生成缩略图

    来源:微信公众号CodeL 前不久产品经理提出一个X的需求,说上传office文件的时候需要将首页自动截图,用于显示文件列表的时候将文件第一页缩略图展示给用户.实现的方式有多种,这里给大家介绍一个简单 ...

  5. Office文件上传自动生成缩略图-C#开发

    原文: http://www.knowsky.com/898407.html 上传office文件的时候需要将首页自动截图,用于显示文件列表的时候将文件第一页缩略图展示给用户.实现的方式有多种,这里给 ...

  6. webuploader 上传文件 生成链接下载文件

    最近 在asp.net MVC 项目 需要实现一个Excel和 图片上传功能.之前有使用过SWFUpload 做过上传图片功能,在本次实现过程中,有人推荐WebUploader 上传组件,因此采用we ...

  7. CI自带的文件上传及生成缩略图

    /* * 文件上传 * @param $upload_path 文件上传路径 * @param $formpic 表单name属性名称 */ private function doUpload($up ...

  8. Yii 图片FTP批量上传 并生成缩略图

    图片批量上传,前台使用 uploadify.swf,这个就不介绍了.这里使用两个扩展,一个是FTP上传的扩展,还有一个是生成缩略图的扩展地址:http://www.yiiframework.com/e ...

  9. java 上传文件-生成文件首页缩略图 生成pdf 抓取图片

    方法:1.文件转换成pdf(采用openoffice或者jacob)   2.抓取pdf首页图 第一步:采用jacob: a.下载jacob  注意区分32位,64位,否则不能用 将dll文件放在ja ...

  10. jquery php ajax多图片上传.上传进度,生成缩略图

    本例用到其他2个php class.upload.php和 functions.php还有css和js以及img文件 下载地址为www.freejs.net/demo/91/down.zip 演示 J ...

随机推荐

  1. Redis监控数据分布工具Redis-audit 使用总结

    Redis-audit 是一个用ruby实现的脚本,通过它,我们可以知道每一类 key 对内存的使用量.它可以提供的数据有:某一类 key 值的访问频率如何,有多少值设置了过期时间,某一类 key 值 ...

  2. canvas中window坐标转换为canvas坐标

    function getMousePos(canvas, evt) { var rect = canvas.getBoundingClientRect(); return { x: evt.clien ...

  3. 控制 Memory 和 CPU 资源的使用

    Resource Governor的出现,解决了在一台SQL Server实例上,管理多用户工作负载和资源隔离的需求,它允许管理员限制系统处理Requsts时所耗费的CPU 和 Memory资源的数量 ...

  4. JavaScript中SetInterval与setTimeout的用法详解

    setTimeout 描述 setTimeout(code,millisec) setTimeout() 方法用于在指定的毫秒数后调用函数或计算表达式. 注:调用过程中,可以使用clearTimeou ...

  5. 有关css3的一些问题

    CSS3新特性(阴影.动画.渐变.变形.伪元素等) CSS3与页面布局学习总结--CSS3新特性(阴影.动画.渐变.变形.伪元素等)     目录 一.阴影 1.1.文字阴影 1.2.盒子阴影 二.背 ...

  6. 卸载jdk以及重新安装jdk

    新旧交替重复安装会混乱,个人解决办法是: 1. 用系统 control panel 中 uninstall 卸载java se development kit 和 java update. 2. 打开 ...

  7. less基本语法

    1.新建less文件 xx.less 和css文件存放在一起 2. 在less文件里声明编码格式 @charset "utf-8"; 3.把项目拖入Koala里 4.选中less文 ...

  8. find指令参数

    1.name ~ 根目录 . 当前和子目录 name之后跟的是文件名 find . -name "[a-z]*[4-9].log" -print 2.perm perm后面跟的是权 ...

  9. 64位win7系统中vb工程显示加载MSCOMCTL.OCX失败

    MSCOMCTL.OCX明明已经注册成功,但还是提示加载失败,对象未注册 尝试过的方法:system32中注册,syswow64中注册,vb打sp6补丁, 修改工程文件:用记事本打开VBP文件找到这一 ...

  10. C# 给枚举定义DescriptionAttribute,把枚举转换为键值对

    在C#中,枚举用来定状态值很方便,例如我定义一个叫做Season的枚举 public enum Season { Spring = 1, Summer = 2, Autumn = 3, Winter ...