当前位置:首页 » 文件传输 » c图片上传
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

c图片上传

发布时间: 2022-03-08 23:16:38

㈠ C#图片批量上传C/S端的

我来告诉你标准答案!上网找一下,现在有很多别人已经实现的插件可以用

㈡ C#如何上传图片

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
/// <summary>
/// 图片处理
/// </summary>
public class FilePath
{
public FilePath()
{
//
//TODO: 在此处添加构造函数逻辑
//
}
/**/
/// <summary>
/// 生成缩略图
/// </summary>
/// <param name="originalImagePath">源图路径(物理路径)</param>
/// <param name="thumbnailPath">缩略图路径(物理路径)</param>
/// <param name="width">缩略图宽度</param>
/// <param name="height">缩略图高度</param>
/// <param name="mode">生成缩略图的方式</param>
public static void MakeThumbnail(string originalImagePath, string thumbnailPath, int width, int height, string mode)
{
System.Drawing.Image originalImage = System.Drawing.Image.FromFile(originalImagePath);
int towidth = width;
int toheight = height;
int x = 0;
int y = 0;
int ow = originalImage.Width;
int oh = originalImage.Height;
switch (mode)
{
case "HW"://指定高宽缩放(可能变形)
break;
case "W"://指定宽,高按比例
toheight = originalImage.Height * width / originalImage.Width;
break;
case "H"://指定高,宽按比例
towidth = originalImage.Width * height / originalImage.Height;
break;
case "Cut"://指定高宽裁减(不变形)
if ((double)originalImage.Width / (double)originalImage.Height > (double)towidth / (double)toheight)
{
oh = originalImage.Height;
ow = originalImage.Height * towidth / toheight;
y = 0;
x = (originalImage.Width - ow) / 2;
}
else
{
ow = originalImage.Width;
oh = originalImage.Width * height / towidth;
x = 0;
y = (originalImage.Height - oh) / 2;
}
break;
default:
break;
}
//新建一个bmp图片
System.Drawing.Image bitmap = new System.Drawing.Bitmap(towidth, toheight);
//新建一个画板
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap);
//设置高质量插值法
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
//设置高质量,低速度呈现平滑程度
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
//清空画布并以透明背景色填充
g.Clear(System.Drawing.Color.Transparent);
//在指定位置并且按指定大小绘制原图片的指定部分
g.DrawImage(originalImage, new System.Drawing.Rectangle(0, 0, towidth, toheight),
new System.Drawing.Rectangle(x, y, ow, oh),
System.Drawing.GraphicsUnit.Pixel);
try
{
//以jpg格式保存缩略图
bitmap.Save(thumbnailPath, System.Drawing.Imaging.ImageFormat.Jpeg);
}
catch (System.Exception e)
{
throw e;
}
finally
{
originalImage.Dispose();
bitmap.Dispose();
g.Dispose();
}
}

/**/
/// <summary>
/// 在图片上增加文字水印
/// </summary>
/// <param name="Path">原服务器图片路径</param>
/// <param name="Path_sy">生成的带文字水印的图片路径</param>
/// <param name="addText">水印文字内容</param>
/// <param name="Fontname">字体大小</param>
/// <param name="Draw">文字左边距离</param>
/// <param name="Drah">文字右边距离</param>
public static void AddWater(string Path, string Path_sy, string addText, int Fontname, int Draw, int Drah)
{
System.Drawing.Image image = System.Drawing.Image.FromFile(Path);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(image);
g.DrawImage(image, 0, 0, image.Width, image.Height);
System.Drawing.Font f = new System.Drawing.Font("Verdana", Fontname);
System.Drawing.Brush b = new System.Drawing.SolidBrush(System.Drawing.Color.Green);
g.DrawString(addText, f, b, 35, 35);
g.Dispose();
image.Save(Path_sy);
image.Dispose();
}
/**/
/// <summary>
/// 在图片上生成图片水印
/// </summary>
/// <param name="Path">原服务器图片路径</param>
/// <param name="Path_syp">生成的带图片水印的图片路径</param>
/// <param name="Path_sypf">水印图片路径</param>
public static void AddWaterPic(string Path, string Path_syp, string Path_sypf)
{
System.Drawing.Image image = System.Drawing.Image.FromFile(Path);
System.Drawing.Image Image = System.Drawing.Image.FromFile(Path_sypf);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(image);
g.DrawImage(Image, new System.Drawing.Rectangle(image.Width - Image.Width, image.Height - Image.Height, Image.Width, Image.Height), 0, 0, Image.Width, Image.Height, System.Drawing.GraphicsUnit.Pixel);
g.Dispose();
image.Save(Path_syp);
image.Dispose();
}
//// <summary>
/// 删除文件文件或图片
/// </summary>
/// <param name="path">当前文件的路径</param>
/// <returns>是否删除成功</returns>
public static bool FilePicDelete(string path)
{
bool ret = false;
System.IO.FileInfo file = new System.IO.FileInfo(path);
if (file.Exists)
{
file.Delete();
ret = true;
}
return ret;
}
}

㈢ 为什么我只能从c:单张上传相片到百度云

重新下载网络云,安装网络云,你可以选择上传的路径的。

㈣ 有一个C开头的上传图片的网站网址是多少来这

是这个吧
c.imqqjs.com
我都是用这个上传图片,挺稳定的。

㈤ C证怎么下载的照片怎么上传

咨询记录 · 回答于2021-09-30

㈥ 在C#中,如何实现上传图像的功能……

参考代码如下:string filepath = FileUpload1.PostedFile.FileName;
string filename = filepath.Substring(filepath.LastIndexOf( "\\ "));
string fileEx = filepath.Substring(filepath.LastIndexOf( ". ")+1);
string serverpath = "C:/aa/upload/ " + filename;
string dbpath = "\\upload\\ " + filename;
if (fileEx == "jpg " || fileEx == "bmp " || fileEx == "gif ")
{
FileUpload1.PostedFile.SaveAs(serverpath);
Response.Write( "成功 ");
Image1.ImageUrl = @ "..\aa\upload\ " + filename;
}
else
{
Response.Write( "失败 ");
}
string sql = "insert into gc_carno(id,carno,model,carphoto) values(100, ' "+TextBox1.Text+ " ', ' "+TextBox2.Text+ " ', ' "+dbpath+ " ') ";
OracleConnection conn = sda.getoracleconnection();
conn.Open();
OracleCommand cmd = new OracleCommand(sql,conn);

int i = cmd.ExecuteNonQuery();
if (i == 1)
{
Response.Write( " <script language= 'javascript '> alert( '添加成功 ') </script> ");
}
else
{
Response.Write( " <script language= 'javascript '> alert( '添加失败 ') </script> ");
}
数据库存储的是服务器图片的物理地址,数据类型是varchar型。

㈦ 怎样从电脑上往8010c上传图片啊

蓝牙,红外,数据线。彩信。

㈧ C/S程序如何上传图片文件到服务器

以文件形式保存在一个文件夹里,文件名用GUID方式命名

㈨ e251c上传照片

要安PC STUDIO 才行 这样手机的内存才能连接上
或者你可以先把照片复制到存储卡上 然后在从存储卡上移到电脑里面去

㈩ 我在报名2级c语言,照片上传时显示javascript:_doPostBack("btnUpload"),是什么问题,怎么改

是javascript提交表单的机制,__doPostBack(eventTarget,eventArgument),eventTarget点击的对象比如button,eventArgument是事件的参数,button的onclick事件转化成HTML语言就是对应的__doPostBack(button的Name,''),javascript:__doPostBack('anp1','2'),anp1可能是换页的,如果是页面的话,就是anp1为页面控件,2为页码索引为第三页,找后台的anp1控件的SelectIndex_change后台事件