类名: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 ...
随机推荐
-
【转】最佳Restful API 实践
原文转自:https://bourgeois.me/rest/ REST APIs are a very common topic nowaday; they are part of almost e ...
-
定位position
position : absolute | relative | fixed | static 定位:子集可以超出父级的范围,如父级蛇overflow:hidden则看不到. absolute : 绝 ...
-
WP8.1 Study5:Data binding数据绑定
一.数据绑定 最简单的编程UI控件的方法是写自己的数据来获取和设置控件的属性,e.g. , textBox1.Text = "Hello, world"; 但在复杂的应用程序,这样 ...
-
mysql 累加排序求名次
自己做的一个小项目里需要用mysql计算一些信息. mysql中的 表如下(注:表中数据都是测试数据,随机生成的) mysql> select * from shake_log; +-----+ ...
-
JavaScript Infinite scroll &; Masonry
// infinitescroll() is called on the element that surrounds // the items you will be loading more of ...
-
PPT插件 用js制作PPT
https://github.com/bartaz/impress.js/ deck.js
-
探讨javascript面向对象编程
(个人blog迁移文章.) 前言: 下面将探讨javascript面向对象编程的知识. 请不要刻意把javascript想成面向对象编程是理所当然的. javascript里面,对象思想不可少,但是不 ...
-
理解不为人知的ClassLoader
JAVA类装载方式,有两种: 1.隐式装载, 程序在运行过程中当碰到通过new 等方式生成对象时,隐式调用类装载器加载对应的类到jvm中. 2.显式装载, 通过class.forname()等方法,显 ...
-
关于SQLserver2008索引超出了数据
由于公司只支持了2008.不支持2012的数据库.所以安装的2008.但在对表进行操作的时候出现如下异常: 这个问题是由于本地装的2008,但IT那边的测试机上面确装的2012.所以2008连接了20 ...
-
python测试开发django-9.使用navicat连接mysql
前言 navicat 是一个连接数据库的可视化工具,可以连接mysql和oracle做一些简单增删改查,对于初学者来说非常方便的 navicat安装 navicat版本比较多,分享一个我经常用的版本 ...