图片裁剪PhotoCropper
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-04-12
<script src="js/prototype.js" type="text/javascript"></script> <script src="js/scriptaculous.js?load=builder,dragdrop" type="text/javascript"></script> <script src="js/cropper.js" type="text/javascript"></script> <script type="text/javascript"> function onEndCrop( coords, dimensions ) { $( ''<%=x1.ClientID%>'' ).value = coords.x1; $( ''<%=y1.ClientID%>'' ).value = coords.y1; $( ''<%=x2.ClientID%>'' ).value = coords.x2; $( ''<%=y2.ClientID%>'' ).value = coords.y2; $( ''<%=width.ClientID%>'' ).value = dimensions.width; $( ''<%=height.ClientID%>'' ).value = dimensions.height; } Event.observe( window, ''load'', function() { new Cropper.ImgWithPreview( ''<%=imgSample.ClientID%>'', { minWidth: 67, minHeight: 86, onEndCrop: onEndCrop, displayOnInit: true } ) } ); </script> <div> <asp:Image id="imgSample" runat="server" /> <div id="previewArea"></div> <asp:Button ID="btnCrop" runat="server" Text="Crop Image" OnClick="btnCrop_Click" /> <asp:Button ID="btnReset" runat="server" Text="Restart Demo" Visible="false" OnClick="btnReset_Click" /> <br /> <input type="text" name="x1" id="x1" runat="server" style="visibility:hidden;"/> <input type="text" name="y1" id="y1" runat="server" style="visibility:hidden;"/> <input type="text" name="x2" id="x2" runat="server" style="visibility:hidden;"/> <input type="text" name="y2" id="y2" runat="server" style="visibility:hidden;"/> <input type="text" name="width" id="width" runat="server" style="visibility:hidden;"/> <input type="text" name="height" id="height" runat="server" style="visibility:hidden;"/> </div> using System; using System.Web; using System.IO; using System.Web.UI; using System.Drawing; using System.Drawing.Imaging; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; public partial class PhotoCropper : System.Web.UI.Page { //原图 private const string ORIG_SAMPLE_PHOTO_URL ="photos/2.jpg"; //裁剪图 private const string CROPPED_SAMPLE_PHOTO_URL = "photos/2Cropped.jpg" |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
上一篇: asp.net Attribute的妙用下一篇: ASP.NET判断是否为移动设备
关于图片裁剪PhotoCropper的所有评论