六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

如何在上傳的圖片上寫字

[摘要]很多時候需要在用戶上傳的圖片上加上版權或者一些其他的附加文字信息,如何實現這樣的功能,下面帖個簡單實現的例子,起到拋磚引玉的作用。<%@ Page Language="c#" Debug="true" Trace="true"%&g...

很多時候需要在用戶上傳的圖片上加上版權或者一些其他的附加文字信息,如何實現這樣的功能,下面帖個簡單實現的例子,起到拋磚引玉的作用。
<%@ Page Language="c#" Debug="true" Trace="true"%>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<html>
<script runat =server>
      void UploadBtn_Click(Object sender, EventArgs e) {
        String filename;
        String filename1;
        String[] filename2;
        int q;
        filename=UploadFile.PostedFile.FileName ;
        filename2=filename.Split(new Char[] {'\\'});
        q=filename2.GetUpperBound(0);
        filename1=filename2[q];
        dis.Text="上傳文件名:"+filename1+"<br>";
        UploadFile.PostedFile.SaveAs(Server.MapPath(filename1));
        ImageEditor.Visible = true;
        dis.Text+="文件大小:"+UploadFile.PostedFile.ContentLength+"字節數";
        Image1.Src=filename1;     
      }
      void UpdateBtn_Click(Object sender, EventArgs e) {
        String filename1;
        filename1=Image1.Src;
        System.Drawing.Image image = System.Drawing.Image.FromFile(Server.MapPath(filename1));
        System.Drawing.Image newimage = new Bitmap(image.Width, image.Height, PixelFormat.Format32bppRGB);
        Graphics g = Graphics.FromImage(newimage);
        g.DrawImage(image,0,0,image.Width,image.Height);
        Font f = new Font(FontType.SelectedItem.Text, Int32.Parse(FontSize.SelectedItem.Text));
        Brush b = new SolidBrush(Color.Red);
        g.DrawString(Caption.Text, f, b, 10, 140);
        g.Dispose();
        System.Drawing.Image thumbImage = newimage.GetThumbnailImage(Int32.Parse(Width.Text),Int32.Parse
(Height.Text),null,0);
        image.Dispose();
        thumbImage.Save(Server.MapPath(filename1), ImageFormat.JPEG);
        Image1.Src=filename1;     
        Caption.Text="";   
 
      }

  </script>

  <body>
  <asp:label id="dis" runat=server/>
    <form enctype="multipart/form-data" runat=server>
          選擇上傳文件: <input id="UploadFile" type=file runat=server>
          <asp:button Text="Upload Me!" OnClick="UploadBtn_Click" runat=server/>
          <hr>
          <asp:panel id="ImageEditor" Visible=false runat=server>
            <img ID="Image1" src="" runat="server"/>
                圖像寬度: <asp:textbox id="Width" runat=server/>
                圖像高度: <asp:textbox id="Height" runat=server/> <br>
                文本標題: <asp:textbox id="Caption" runat=server/>
                標題字號: <asp:dropdownlist id="FontSize" runat=server>
                                        <asp:listitem>14</asp:listitem>
                                        <asp:listitem>18</asp:listitem>
                                        <asp:listitem>26</asp:listitem>
                                        <asp:listitem>36</asp:listitem>
                                        <asp:listitem>48</asp:listitem>
                                        <asp:listitem>62</asp:listitem>
                                      </asp:dropdownlist>
                標題字體: <asp:dropdownlist id="FontType" runat=server>
                                        <asp:listitem>黑體</asp:listitem>
                                        <asp:listitem>仿宋</asp:listitem>
                                        <asp:listitem>隸書</asp:listitem>
                                        <asp:listitem>楷書</asp:listitem>
                                        <asp:listitem>彩云</asp:listitem>
                                        <asp:listitem>新魏</asp:listitem>
                                      </asp:dropdownlist>
                                               
                <asp:button Text="Update Image" OnClick="UpdateBtn_Click" runat=server/>
          </asp:panel>
      </form>

  </body>
</html>




主站蜘蛛池模板: 欧美专区在线 | 影音先锋国产系列精品 | 欧美性生活一级 | 在线观看精品国产福利片100 | 欧美一区二区三区四区五区六区 | 色综合色综合色综合 | 亚洲欧美一区二区三区在线观看 | 五月婷婷丁香六月 | 欧美综合图区亚欧综合图区 | 四虎影院成人 | 欧美一级淫片免费播放40分钟 | 四虎国产永久免费久久 | 欧美丝袜办公室精品 | 日本免费不卡视频一区二区三区 | 四虎影院色| 日韩午夜精品 | 视频一区中文字幕 | 日韩精品视频在线免费观看 | 欧美视频一 | 天干夜天干天干国产 | 青春久久| 欧美亚洲综合视频 | 在线视频欧美精品 | 日本五级床片免费 | 青青青国产精品手机在线观看 | 亚洲视频在线观看一区 | 欧美亚洲欧美 | 欧美一级特黄一片免费 | 午夜神器成在线人成在线人免费 | 日本视频在线免费观看 | 色综合久久久久久久久久久 | 欧美五月 | 桃花综合久久久久久久久久网 | 伊人久久综合 | 西瓜影院日韩大片在线观看 | 四虎影院入口 | 在线播放精品视频 | 亚洲天堂婷婷 | 亚洲国产欧美在线 | 欧美综合图片一区二区三区 | 日韩一级片免费观看 |