1.ASP.NET中实现邮件系统
2.ASP.NET中存取图片到数据库
(1)将图片以二进制存储到数据库
string pictureUrl ="";
OpenFileDialog ofd = new OpenFileDialog();
ofd.InitialDirectory = "d:";
ofd.RestoreDirectory = true;
ofd.Filter = "*.jpg|*.jpg|*.bmp|*.bmp";
if (ofd.ShowDialog() == DialogResult.OK)
{
try
{
pictureUrl = ofd.FileName;//取得图片路径
pictureBox1.Image = Image.FromFile(pictureUrl);//将图片显示在pictureBox1控件中
FileStream fs = new FileStream(pictureUrl, FileMode.Open, FileAccess.Read);//将图片以文件流的形式进行保存
BinaryReader br = new BinaryReader(fs);
imgBytesIn = br.ReadBytes((int)fs.Length);
}
catch
{
MessageBox.Show("您选择的图片不能被读取或文件类型不对!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
imgBytesIn = null;
}
}
(2)将数据库中的以二进制形式保存的图片存入到字节数组中
try
{
pic=(byte[])(ds.Tables[0].Rows[0]["photo"]);
MemoryStream ms = new MemoryStream(pic);//将字节数组存入到二进制流中
pictureBox1.Image = Image.FromStream(ms);//二进制流Image控件中显示
}
catch
{
pictureBox1.Image = null;
}
3.用XML传送图片
4.ASP.NET中的图像质量