国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > 綜合 > 正文

就是那個(gè)上傳的。按實(shí)際上傳時(shí)的文件名稱保存(不在是test.jpg了)圖片可以改大小,圖上寫字(可選

2024-07-21 02:16:32
字體:
供稿:網(wǎng)友
國內(nèi)最大的酷站演示中心!
<%@ 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+="文件大?。?quot;+uploadfile.postedfile.contentlength+"字節(jié)數(shù)";
         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>

          <h3>

          select file to upload: <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"/>

             <h3>
                image width: <asp:textbox id="width" runat=server/>

                 image height: <asp:textbox id="height" runat=server/> <br>

                 text caption: <asp:textbox id="caption" runat=server/>

                 caption size: <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>
                 caption font: <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/>

             </h3>
          </asp:panel>

      </form>

   </body>
</html>
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 漯河市| 望江县| 桦甸市| 荥经县| 西乌珠穆沁旗| 罗田县| 洛阳市| 姜堰市| 依兰县| 秀山| 南木林县| 东城区| 普陀区| 温宿县| 虞城县| 灵武市| 藁城市| 寻乌县| 内江市| 岚皋县| 台南县| 唐山市| 昭苏县| 东港市| 清徐县| 临汾市| 临漳县| 白水县| 罗山县| 荃湾区| 中卫市| 肥西县| 惠来县| 莱芜市| 措美县| 馆陶县| 阿勒泰市| 南溪县| 阿勒泰市| 堆龙德庆县| 介休市|