类名: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. C语言中判断int,long型等变量是否赋值的方法

    博主这段时间在写一些C程序的代码,由于以前对C不是了解很多,故遇到很多瓶颈,当然,其中也有很多有趣的方法可以利用以解决这些难题,下面这个问题就是博主遇到的一个麻烦. 声明了 int ,long 型等局 ...

  2. 通过VNC Viewer使用VMware虚拟机的远程桌面连接

    本文转自:http://www.14blog.com/archives/185 要在VMware虚拟机中使用远程桌面连接?方法有两个:一种是在虚拟机中做“端口映射”,当然,这个稍显复杂(虚拟机端口映射 ...

  3. Execl导入问题之文本转换

    前些天在基础数据的导入过程中,遇到了这样一个问题:数据明明存在,可是就是不识别!给出的错误提示是:该数据对应的外键不存在! 我找出其中的一条数据,在外键表中查询是存在的!问题出在哪里了呢? 从exec ...

  4. ffmpeg利用libav库把yuv视频流转换为TS串流

    今天到月末了,才发我这个月的第一篇文章,因为这个月前三周一直在看ffmpeg的libavcodec和libavformat两个库源码.实验室要做一个“小传大”的软件,就是android手机或平板电脑的 ...

  5. Windows下安装Redmine-2.5.3

    安装准备 服务器操作系统:Windows Server 2008 R2 Standard,64位操作系统. RailsInstaller版本:2.2.4  (下载地址http://railsinsta ...

  6. MySQL基础知识2

  7. 《CLR Via C#》读书笔记,持续更新...

    写了快5年代码了,一直都是使用别人发明的语言,别人发明的框架做快速开发,还从来没有真正深刻的学习过底层的一些东西,于是今年我打算读<CLR Via C#>这本书,认识一下C#的底层,我觉得 ...

  8. 浅析ARP协议及ARP攻击

    一. ARP数据包结构 (1)硬件类型:指明发送方想知道的硬件接口类型,以太网的值为1:(2)协议类型:指明发送方提供的高层协议类型:它的值为 0x0800 即表示 IP地址.(3)硬件地址长度和协议 ...

  9. make -j 多核并行编译 导致笔记本过热 自动关机保护

    中午在装着CentOS的笔记本上把 Oneinstack 跑起来然后去上班了,本来等着下班回来用的,回来之后发现是关机状态,环境也没有装好. 查看日志,找不到相关信息,甚至还以为是被入侵了.又试了几遍 ...

  10. Java写入文件

    import java.io.File;import java.io.FileNotFoundException;import java.io.PrintWriter; public class Fi ...