zoukankan
html css js c++ java
图片及生成缩略图
把图片上传到服务器,并生成一个缩略图
UpImage.aspx
<%
@ Page language
=
"
c#
"
Codebehind
=
"
UpImage.aspx.cs
"
AutoEventWireup
=
"
false
"
Inherits
=
"
Sand.WebForm4
"
%>
<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
>
<
HTML
>
<
HEAD
>
<
title
>
WebForm4
</
title
>
<
meta
name
="GENERATOR"
Content
="Microsoft Visual Studio .NET 7.1"
>
<
meta
name
="CODE_LANGUAGE"
Content
="C#"
>
<
meta
name
="vs_defaultClientScript"
content
="JavaScript"
>
<
meta
name
="vs_targetSchema"
content
="http://schemas.microsoft.com/intellisense/ie5"
>
</
HEAD
>
<
body
MS_POSITIONING
="GridLayout"
>
<
form
id
="Form1"
method
="post"
runat
="server"
>
<
FONT
face
="宋体"
><
INPUT
id
="UpFile"
style
="Z-INDEX: 101; LEFT: 256px; POSITION: absolute; TOP: 152px"
type
="file"
runat
="server"
><
INPUT
id
="Submit_File"
style
="Z-INDEX: 102; LEFT: 504px; POSITION: absolute; TOP: 152px"
type
="button"
value
="上传"
name
="Button1"
runat
="server"
></
FONT
>
</
form
>
</
body
>
</
HTML
>
UpImage.aspx.cs
private
void
Button1_ServerClick(
object
sender, System.EventArgs e)
{
string
UpFileName
=
UpFile.PostedFile.FileName.Substring(UpFile.PostedFile.FileName.LastIndexOf(
"
\\
"
),UpFile.PostedFile.FileName.Length
-
UpFile.PostedFile.FileName.LastIndexOf(
"
\\
"
));
UpFile.PostedFile.SaveAs(Server.MapPath(
"
Images\\
"
+
UpFileName));
System.Drawing.Image ObjDrImage
=
System.Drawing.Image.FromFile(Server.MapPath(
"
Images\\
"
+
UpFileName));
System.Drawing.Bitmap BMP
=
new
System.Drawing.Bitmap(
60
,
80
,System.Drawing.Imaging.PixelFormat.Format16bppRgb555);
System.Drawing.Graphics G
=
System.Drawing.Graphics.FromImage(BMP);
G.Clear(Color.Transparent);
G.DrawImage(ObjDrImage,
new
System.Drawing.Rectangle(
new
System.Drawing.Point(
0
,
0
),
new
System.Drawing.Size(
60
,
80
)),
0
,
0
,ObjDrImage.Width,ObjDrImage.Height,System.Drawing.GraphicsUnit.Pixel);
BMP.Save(Server.MapPath(
"
ImagesSL\\SL.jpg
"
),System.Drawing.Imaging.ImageFormat.Jpeg);
G.Dispose();
G
=
null
;
BMP.Dispose();
BMP
=
null
;
ObjDrImage.Dispose();
ObjDrImage
=
null
;
}
查看全文
相关阅读:
python检测挖矿特征的几种方式
python检测当前端口是否使用
matlab界面UI设计资料
python中struct.pack()函数和struct.unpack()函数
网络编程:主机字节序和网络字节序
【原创】python中文编码问题深入分析(三):python2.7文件读写中文编码问题
【原创】python中文编码问题深入分析(二):print打印中文异常及显示乱码问题分析与解决
ivew定制主题 less ^3.0 时报错 .bezierEasingMixin(); Inline JavaScript is not enabled. Is it set in your options?
Vue子组件中 data 从props中动态更新数据
Vue 自动吸顶
原文地址:https://www.cnblogs.com/Sandheart/p/94782.html
最新文章
Xcode中的Target
Xcode中的文件类型
Mac SpotLight无法搜索
Node.js中exports,module.exports以及require方法
Node.js中module文件定义的top-level变量为何是私有的
Objective-C中,类方法的getter和setter可以用点运算符吗?
PHP的垃圾回收
在Web Page中包含PHP代码
PHP中的文件包含
PHP中的变量
热门文章
Codeup 25609 Problem I 习题5-10 分数序列求和
Codeup 25594 Problem H 例题5-8 Fibonacci数列
Codeup 25593 Problem G 例题5-7 求圆周率pi的近似值
mysql安装与sqlyog安装
adb命令查看连接PC的移动设备
wireshark抓包新手教程(win10空包问题)
Python完成迪杰斯特拉算法并生成最短路径
vs2017环境下python包的安装
python读取文件行数和某行内容
近期学习python的小问题及解决方案
Copyright © 2011-2022 走看看