【.NET】上传文件,生成缩略图
类名: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】上传文件,生成缩略图的更多相关文章
- yii php 图片上传与生成缩略图
今天需要做图片上传与生成缩略图的功能,把代码进行记录如下: html 视图 ($pic_action_url = $this->createAbsoluteUrl('h ...
- tp3.2 自带的文件上传及生成缩略图功能
public function upload_file($file_name,$width,$height) { //检查图片尺寸是否合法 $image_size = getimagesize($_F ...
- spring boot:实现图片文件上传并生成缩略图(spring boot 2.3.1)
一,为什么要给图片生成缩略图? 1, 用户上传的原始图片如果太大,不能直接展示在网站页面上, 因为不但流费server的流量,而且用户打开时非常费时间, 所以要生成缩略图. 2,服务端管理图片要注意的 ...
- Office文件上传自动生成缩略图
来源:微信公众号CodeL 前不久产品经理提出一个X的需求,说上传office文件的时候需要将首页自动截图,用于显示文件列表的时候将文件第一页缩略图展示给用户.实现的方式有多种,这里给大家介绍一个简单 ...
- Office文件上传自动生成缩略图-C#开发
原文: http://www.knowsky.com/898407.html 上传office文件的时候需要将首页自动截图,用于显示文件列表的时候将文件第一页缩略图展示给用户.实现的方式有多种,这里给 ...
- webuploader 上传文件 生成链接下载文件
最近 在asp.net MVC 项目 需要实现一个Excel和 图片上传功能.之前有使用过SWFUpload 做过上传图片功能,在本次实现过程中,有人推荐WebUploader 上传组件,因此采用we ...
- CI自带的文件上传及生成缩略图
/* * 文件上传 * @param $upload_path 文件上传路径 * @param $formpic 表单name属性名称 */ private function doUpload($up ...
- Yii 图片FTP批量上传 并生成缩略图
图片批量上传,前台使用 uploadify.swf,这个就不介绍了.这里使用两个扩展,一个是FTP上传的扩展,还有一个是生成缩略图的扩展地址:http://www.yiiframework.com/e ...
- java 上传文件-生成文件首页缩略图 生成pdf 抓取图片
方法:1.文件转换成pdf(采用openoffice或者jacob) 2.抓取pdf首页图 第一步:采用jacob: a.下载jacob 注意区分32位,64位,否则不能用 将dll文件放在ja ...
- jquery php ajax多图片上传.上传进度,生成缩略图
本例用到其他2个php class.upload.php和 functions.php还有css和js以及img文件 下载地址为www.freejs.net/demo/91/down.zip 演示 J ...
随机推荐
- Python学习入门基础教程(learning Python)--2.3.3Python函数型参详解
本节讨论Python下函数型参的预设值问题. Python在设计函数时,可以给型参预设缺省值,当用户调用函数时可以不输入实参.如果用户不想使用缺省预设值则需要给型参一一赋值,可以给某些型参赋值或不按型 ...
- mybatis 入门进阶之 mapper
由于上节 <mybatis 入门优化>中的dao实现类耦合了user.xml中的statment的id,例如:src.main.resource.userMapper.findUserBy ...
- 怎么在Windows下安装Linux虚拟机
前提:①电脑有安装好VMware Workstation Pro虚拟机,没有的话点此下载并安装.②下载好CentOS-7-x86_64-DVD-1503-01镜像文件,没有点此下载密码:lomg. 1 ...
- Python3.5环境下安装wxPtyhon
Win7系统下,Python3.5环境下安装wxPtyhon, 已成功安装并运行. 1.先从下面网站下载对应的whl版本. https://wxpython.org/Phoenix/snapshot- ...
- 试图解释下ERP
ERP,字面的意思就是企业资源规划.但现在基本上是企业信息系统的统称,过去叫MIS.我们就是有这个本事,不管什么高大上的事物,很快就会做的很烂. 你可以这样理解ERP. 现在来了个订单,你需要回答下面 ...
- 有关linux标准输出、标准输入、标准错误的重定向问题
1.简单的命令行重定向问题. 例:ls -al test test1 test2 1>out.txt 2>err.tx 这里ls这句命令行命令之后将标准输入重定向到out ...
- Base64加密与解密
import sun.misc.BASE64Decoder;import sun.misc.BASE64Encoder; // 将 str进行 BASE64 编码 public static Stri ...
- [SQL基础教程] 5-1视图
[SQL基础教程] 5-1视图 视图和表 从SQL角度看视图就是一张表 视图与表的差别 表保存了实际的数据,视图保存的是SELECT语句: 视图的优点 节省存储空间: 将常用的Select 语句保存成 ...
- zabbix 安装配置以及漏洞检测脚本
最近zabbix爆出sql注入漏洞.之前一直没装过.就想着来安装一次.我在centos配置玩玩,记录一下:1.安装LAMP yum -y install httpd mysql mysql-ser ...
- hadoop(二)
三 Hive和Hbase #安装配置Hbase环境#主要参考https://my.oschina.net/zc741520/blog/388718网站配置的是集群,这里是伪分布,将网站中涉及多个主机的 ...