当前位置: 首页 > news >正文

推进网站集约化建设制度衡阳县建设局网站

推进网站集约化建设制度,衡阳县建设局网站,建设网站需要问的问题,常州做企业网站在SQL SERVER中建立这样结构的一个表#xff1a;列名类型目的IDInteger主键IDIMGTITLEVarchar(50)图片的标题IMGTYPEVarchar(50)图片类型. ASP.NET要以辨认的类型IMGDATAImage用于存储二进制数据 using System;using System.Collections;using System.Configuration;using…在SQL SERVER中建立这样结构的一个表列名类型目的IDInteger主键IDIMGTITLEVarchar(50)图片的标题IMGTYPEVarchar(50)图片类型. ASP.NET要以辨认的类型IMGDATAImage用于存储二进制数据       using System;using System.Collections;using System.Configuration;using System.Data;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;using System.Drawing;using System.Drawing.Imaging;using System.Drawing.Drawing2D;using System.Data.SqlClient;using System.IO; public partial class ChangeImageSize : System.Web.UI.Page{    protected void Page_Load(object sender, EventArgs e)    {     }         private int width;        private int height;        private Bitmap newpic, savepic;        private float k1, k2;         /// summary        /// 构造函数        /// /summary        public ChangeImageSize()        {        }                       /// summary        /// 传入一张图片并设定它的大小        /// /summary        /// param nameTheImage传入的图片对象/param        /// param nameTheWidth图片宽的范围/param        /// param nameTheHeight图片长的范围/param        /// param namepath保存的文件名和路径/param        public Bitmap ChangePicMethod(object TheImage, int TheWidth, int TheHeight)        {            newpic new Bitmap((System.Drawing.Image)TheImage);            this.width newpic.Width;            this.height newpic.Height;             k1 (float)width / (float)TheWidth;            k2 (float)height / (float)TheHeight;            if (k1 k2)            {                this.width (int)(width / k1);                this.height (int)(height / k1);            }            else            {                this.width (int)(width / k2);                this.height (int)(height / k2);            }            savepic new Bitmap(newpic, width, height);            return savepic;            //savepic.Save(path);        }     /// summary    /// 保存图片到数据库    /// /summary    /// returns/returns        private bool StoreImage()        {            bool rs false;            Stream imgdatastream this.FileUpload1.PostedFile.InputStream;            int imgdatalen this.FileUpload1.PostedFile.ContentLength;            string imgtype this.FileUpload1.PostedFile.ContentType;            string imgtitle FileUpload1.PostedFile.FileName;            // byte[] imgdata new byte[imgdatalen];            //int n imgdatastream.Read(imgdata, 0, imgdatalen);            //Bitmap bp ChangePicToSaveMethod(imgdatastream, 200, 200);                       MemoryStream ms new MemoryStream();            Bitmap bp new Bitmap(imgdatastream);            bp ChangePicMethod(bp, 200, 200);            //bpbp.GetThumbnailImage(200,200,new System.Drawing.Image.GetThumbnailImageAbort(aa()) ,System.IntPtr.Zero);            bp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);            ms.Flush();            byte[] imgdata ms.GetBuffer();            ms.Close();               SqlConnection connection Connection.getConnection();            SqlCommand command new SqlCommand(INSERT INTO ImageStore(ImageTitle,ImageType,ImageData)VALUES ( imgtitle, imgtype,imgdata ), connection);             SqlParameter paramTitle new SqlParameter(imgtitle, SqlDbType.VarChar, 50);             paramTitle.Value imgtitle;            command.Parameters.Add(paramTitle);             SqlParameter paramData new SqlParameter(imgdata, SqlDbType.Image);            paramData.Value imgdata;            command.Parameters.Add(paramData);             SqlParameter paramType new SqlParameter(imgtype, SqlDbType.VarChar, 50);            paramType.Value imgtype;            command.Parameters.Add(paramType);             connection.Open();            int numRowsAffected command.ExecuteNonQuery();            connection.Close();            rs true;            return rs;        }    /// summary    /// 从数据库取出图片    /// /summary    /// param namesender/param    /// param namee/param        private void GetImage(string imgid)        {            string sql SELECT ImageData, ImageType FROM ImageStore WHERE ID imgid;            SqlConnection connection Connection.getConnection();            SqlCommand command new SqlCommand(sql, connection);            connection.Open();            SqlDataReader dr command.ExecuteReader();            if (dr.Read())            {                Response.ContentType dr[ImageType].ToString();                Response.BinaryWrite((byte[])dr[ImageData]);            }            connection.Close();         }   }转载于:https://www.cnblogs.com/carekee/articles/2083425.html
http://www.pierceye.com/news/414809/

相关文章:

  • 网站开发集成环境国内html5网站欣赏
  • iis7.5 没有默认网站北京seo的排名优化
  • 两学一做网站是多少钱营销型网站策划怎么做
  • 渭南做网站的自建房设计图
  • 移动网站建设价格线上推广专员是干嘛的
  • 做化妆刷的外贸网站企业网站托管备案
  • 湖南省建设干部学校 网站金融直播室网站建设
  • 贵州建设厅特殊工种考试网站photoshop平面设计教学视频
  • 怎么推广我的网站代理网站推荐
  • wordpress主题站模板做网站跟做APP哪个容易
  • 杭州网站建设公司推荐网站建设优化服务渠道
  • php是网站开发语言吗做网站前端需要编程基础吗
  • python 网站开发 前端企业信用信息系统官网
  • 公司网站设计有哪些使用技巧呢商城网站建设怎么收费
  • 东莞做网站平台安阳营销型网站建设
  • 如何查看网站开发语言百度排行榜风云榜
  • 泉州 网站建设公司首选广告设计公司名字有寓意有创意
  • 天津个人做网站慈利网站制作
  • 专门做推广的网站吗宿迁房价2023年最新房价
  • 0基础12天精通网站建设网站建设 全网推广
  • 东莞网站营销推广公司移动应用开发案例
  • 妇科医院网站建设怎么做网站建设培训心得体会
  • 网站建设 管理正能量网站入口地址
  • 做网站没有创意Wordpress国际收款
  • 网站推广关键词工具wap网站分享到微信
  • 哪个网站可以给图片做链接做网站的公司在哪
  • 搬瓦工可以长期做网站广告制作开票大类是什么
  • 高级网站开发工信部小企业门户网站建设
  • 网站建站知识秦皇岛汽车网站制作
  • 建站之星极速版app开发需求