- 浏览: 2270875 次
- 性别:
- 来自: 成都
文章分类
- 全部博客 (357)
- J2EE (49)
- JavaScript (40)
- Spring (19)
- Struts (5)
- CSS (8)
- Hibernate (16)
- Java (67)
- DWR (4)
- JSON (3)
- XFIRE (1)
- Tomcat (1)
- Ant (2)
- 设计模式 (2)
- 经典收藏 (2)
- JSP (10)
- Linux (0)
- WebLogic (11)
- myeclipse (13)
- Buffalo (4)
- 文件上传相关 (1)
- oracle (33)
- html (6)
- JSTL (3)
- SVN (2)
- GIT (1)
- 孙卫琴(Java网络编程精解) (1)
- DOM4J (2)
- Swing (1)
- AJAX (1)
- Eclipse (5)
- 日志组件 (3)
- PowerDesigner (1)
- Jquery (22)
- IT技术开发相关网址 (1)
- Nutz (1)
- 其它 (1)
- Velocity (3)
- WebService (1)
- MySql (2)
- Android (1)
- Maven (2)
- Quartz (11)
- Lucene (1)
- springsource (1)
- Junit (1)
- Activiti (0)
最新评论
-
yzlseu:
拼凑,没有营养
Activiti进阶—分配组任务 -
zhangsenhao:
非常赞!代码很清楚
SpringMVC3.0+MyIbatis3.0(分页示例) -
xiamw2000:
分页写得不对,应该是 : order by ${orderNa ...
SpringMVC3.0+MyIbatis3.0(分页示例) -
sheertewtw:
...
SpringMVC:上传与下载 -
kingtoon:
...
XSS之xssprotect
一 参考资料
1 jquery Jcrop 头像,logo截图
http://terje.blog.163.com/blog/static/11924371201101311319664/
2 javascript+java截取图像,图像处理
http://www.blogjava.net/b47248054/articles/200685.html
3 js+java 截取照片中的头像
http://blog.csdn.net/dsj188/article/details/4313662
4 java+jsp 截头像图片
http://ldf2008rw.iteye.com/blog/502793
5 Java生成缩略图之Thumbnailator
http://rensanning.iteye.com/blog/1545708
Thumbnailator 是一个为Java界面更流畅的缩略图生成库。从API提供现有的图像文件和图像对象的缩略图中简化了缩略过程,两三行代码就能够从现有图片生成缩略图,且允许微调缩略图生成,同时保持了需要写入到最低限度的代码量。同时还支持根据一个目录批量生成缩略图。 http://code.google.com/p/thumbnailator/这个不错!支持!
二 解决思路
1 通过smart-upload文件上传组件将图片上传到服务器,并得到图片文件地址传递到前台的img组件显示
2 在客户端用JS获取图片X坐标,Y坐标,宽度和高度这四个参数并设置到隐藏元素.
3 java后台根据图片关键的四个参数实现图片剪切并在服务器端生成图片文件
4 通过生成图片的地址在前台展现
开发环境: XP3
开发工具: JDK1.6+MyEclipse6.5+Tomcat6
工程图片:
三 实现方式
1 选用JQuery插件:Jcrop
官方网站:http://deepliquid.com/content/Jcrop.html
项目地址:http://code.google.com/p/jcrop/
效果图片如下:
2 通过图片剪切工具类,主要代码如下:
四 具体代码如下:
1 index.jsp(上传图片页面)
2 ImgUploadServlet.java(图片上传处理类)
3 imgcrop.jsp(图片展现并剪切页面)
4 ImgCropServlet.java(执行图片剪切类)
5 ImageCut.java(图片剪切工具类)
我可以也加嘛?真的挺好的 代码
多谢楼主,我在java里把小数部分舍弃了,基本没多少影响
最新jcrop插件确实可以获得小数,我是做项目的时候遇到了这个问题,出现了异常,你可以试一下截图
1 jquery Jcrop 头像,logo截图
http://terje.blog.163.com/blog/static/11924371201101311319664/
2 javascript+java截取图像,图像处理
http://www.blogjava.net/b47248054/articles/200685.html
3 js+java 截取照片中的头像
http://blog.csdn.net/dsj188/article/details/4313662
4 java+jsp 截头像图片
http://ldf2008rw.iteye.com/blog/502793
5 Java生成缩略图之Thumbnailator
http://rensanning.iteye.com/blog/1545708
Thumbnailator 是一个为Java界面更流畅的缩略图生成库。从API提供现有的图像文件和图像对象的缩略图中简化了缩略过程,两三行代码就能够从现有图片生成缩略图,且允许微调缩略图生成,同时保持了需要写入到最低限度的代码量。同时还支持根据一个目录批量生成缩略图。 http://code.google.com/p/thumbnailator/这个不错!支持!
二 解决思路
1 通过smart-upload文件上传组件将图片上传到服务器,并得到图片文件地址传递到前台的img组件显示
2 在客户端用JS获取图片X坐标,Y坐标,宽度和高度这四个参数并设置到隐藏元素.
3 java后台根据图片关键的四个参数实现图片剪切并在服务器端生成图片文件
4 通过生成图片的地址在前台展现
开发环境: XP3
开发工具: JDK1.6+MyEclipse6.5+Tomcat6
工程图片:
三 实现方式
1 选用JQuery插件:Jcrop
官方网站:http://deepliquid.com/content/Jcrop.html
项目地址:http://code.google.com/p/jcrop/
效果图片如下:
2 通过图片剪切工具类,主要代码如下:
/** * 图像切割(改) * * @param srcImageFile 源图像地址 * @param dirImageFile 新图像地址 * @param x 目标切片起点x坐标 * @param y 目标切片起点y坐标 * @param destWidth 目标切片宽度 * @param destHeight 目标切片高度 */ public static void abscut(String srcImageFile,String dirImageFile, int x, int y, int destWidth, int destHeight) { try { Image img; ImageFilter cropFilter; // 读取源图像 BufferedImage bi = ImageIO.read(new File(srcImageFile)); int srcWidth = bi.getWidth(); // 源图宽度 int srcHeight = bi.getHeight(); // 源图高度 if (srcWidth >= destWidth && srcHeight >= destHeight) { Image image = bi.getScaledInstance(srcWidth, srcHeight, Image.SCALE_DEFAULT); // 改进的想法:是否可用多线程加快切割速度 // 四个参数分别为图像起点坐标和宽高 // 即: CropImageFilter(int x,int y,int width,int height) cropFilter = new CropImageFilter(x, y, destWidth, destHeight); img = Toolkit.getDefaultToolkit().createImage( new FilteredImageSource(image.getSource(), cropFilter)); BufferedImage tag = new BufferedImage(destWidth, destHeight, BufferedImage.TYPE_INT_RGB); Graphics g = tag.getGraphics(); g.drawImage(img, 0, 0, null); // 绘制缩小后的图 g.dispose(); // 输出为文件 ImageIO.write(tag, "JPEG", new File(dirImageFile)); } } catch (Exception e) { e.printStackTrace(); } }
四 具体代码如下:
1 index.jsp(上传图片页面)
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title></title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <script src="/scripts/clearFile.js" type="text/javascript"></script> <script type="text/javascript"> /**检查图片上传类型*/ function checkImgType(obj){ var imgFile = ''; //获取图片的全路径 var imgFilePath = getImgFullPath(obj); var endIndex = imgFilePath.lastIndexOf("\\"); var lastIndex = imgFilePath.length-endIndex-1; if (endIndex != -1) imgFile= imgFilePath.substr(endIndex+1,lastIndex); else imgFile = imgFilePath; var tag = true; endIndex = imgFilePath.lastIndexOf("."); if (endIndex == -1) tag = false; var ImgName = imgFilePath.substr(endIndex+1,lastIndex); ImgName = ImgName.toUpperCase(); if (ImgName !="GIF" && ImgName !="JPG" && ImgName !="PNG" && ImgName !="BMP"){ tag=false; } if (!tag) { alert("上传图片的文件类型必须为: *.gif,*.jpg,*.png,*.bmp,请重新选择!") Upload.clear(obj); return false; } document.form1.submit(); } function getImgFullPath(obj) { if (obj) { //ie if (window.navigator.userAgent.indexOf("MSIE") >= 1) { obj.select(); return document.selection.createRange().text; } //firefox else if (window.navigator.userAgent.indexOf("Firefox") >= 1) { if (obj.files) { return obj.files.item(0).getAsDataURL(); } return obj.value; } return obj.value; } } </script> </head> <body> <form name=form1 method=post enctype="multipart/form-data" action="<%=path%>/imgUpload"> <div style="margin-left: 35%;margin-top: 20%"> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" > <tr> <td > 图片上传<font color='red'>*.gif,*.jpg,*.png,*.bmp</font></td> </tr> <tr> <td width="80%"> <input type="file" name="imgFile" id="imgFile" maxlength="160" onchange="checkImgType(this);" width="300px"/> </td> </tr> </table> </div> </form> </body> </html>
2 ImgUploadServlet.java(图片上传处理类)
import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import javax.imageio.ImageIO; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class ImgUploadServlet extends HttpServlet { private static final long serialVersionUID = 1L; public static final String IMGROOT = "/uploads/"; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request,response); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String userWebAppPath = getWebAppPath(); /**检查是否有图片上传文件夹*/ checkImageDir(userWebAppPath); /**图片上传的相对路径*/ String imgUploadPath = null; String imgWebAppPath = null; /**图片后缀*/ String imgFileExt = null; /**图片名称:以当前日期*/ SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddhhmmss"); String imgFileId = formatter.format(new Date()); //图片初始化高度与宽度 String width = null; String height = null; int imgWidth = 0; int imgHeight = 0; try { com.jspsmart.upload.SmartUpload smartUpload = new com.jspsmart.upload.SmartUpload(); smartUpload.initialize(getServletConfig(), request, response); smartUpload.upload(); com.jspsmart.upload.Request rqest = smartUpload.getRequest(); //指定图片宽度和高度 width = rqest.getParameter("width"); if(null == width){ width = "700"; } height= rqest.getParameter("height"); if(null == height){ height = "600"; } imgWidth = Integer.parseInt(width); imgHeight = Integer.parseInt(height); //文件个数 int fileCounts = smartUpload.getFiles().getCount(); for (int i = 0; i <fileCounts; i++) { com.jspsmart.upload.File myFile = smartUpload.getFiles().getFile(i); if (!myFile.isMissing()) { imgFileExt = myFile.getFileExt(); //组装图片真实名称 imgFileId += i + System.currentTimeMillis() + "." + imgFileExt; //图片生成路径 imgWebAppPath = userWebAppPath + imgFileId; //生成图片文件 myFile.saveAs(imgWebAppPath); //图片的相对路径 imgUploadPath = IMGROOT + imgFileId; //检查图片大小 BufferedImage src = ImageIO.read(new File(imgWebAppPath)); // 读入文件 int imgSrcWidth = src.getWidth(); // 得到源图宽 //重新指定大小 imgWidth = imgSrcWidth > imgWidth ? imgWidth : imgSrcWidth; int imgSrcHeight = src.getHeight(); // 得到源图长 imgHeight = imgSrcHeight > imgHeight ? imgHeight : imgSrcHeight; //按照图片的设置大小生成 ImageCut.scale(imgWebAppPath, imgWebAppPath,imgWidth,imgHeight); File f = new File(imgWebAppPath); if(f.exists()){ System.out.println("创建"+imgWidth+"*"+imgHeight+"图片成功"); } } } }catch(Exception ex){ ex.printStackTrace(); } String path = "/imgcrop.jsp?tag=0&oldImgPath="+imgUploadPath+"&imgFileExt="+imgFileExt+"&imgRoot="+IMGROOT+"&width="+imgWidth+"&height="+imgHeight; System.out.println("path: "+path); request.getRequestDispatcher(path).forward(request,response); } private String getWebAppPath(){ String webAppPath = this.getServletContext().getRealPath("/"); String userWebAppPath = webAppPath+IMGROOT; return userWebAppPath; } private void checkImageDir(String userWebAppPath) { File file = new File(userWebAppPath); if(!file.exists()){ file.mkdir(); } } }
3 imgcrop.jsp(图片展现并剪切页面)
<%@ page language="java" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>图片剪辑</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <link rel="stylesheet" href="styles/jquery.Jcrop.css" type="text/css" /> <link rel="stylesheet" href="styles/demos.css" type="text/css" /> <script src="scripts/jquery.min.js"></script> <script src="scripts/jquery.Jcrop.js"></script> </head> <body STYLE='OVERFLOW:SCROLL;OVERFLOW-X:HIDDEN;OVERFLOW-Y:HIDDEN'> <form name=form1 method=post action="<%=path%>/imgCrop"> <table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" > <tr> <td id="cropTd" style="display:none"><input type="button" value="剪切照片" id="cropButton"/></td> </tr> <tr> <td id="imgTd" style="width:${param.width}px;height:${param.height}px;" align="center" style="padding-top:5px;"> <c:choose> <c:when test="${param.tag eq 0}"> <img src="<%=path%>${param.oldImgPath}" id="imgCrop" name="imgCrop" border="0" /> </c:when> <c:when test="${param.tag eq 1}"> <img src="<%=path%>${param.imgName}" id="imgCrop" name="imgCrop" border="0" /> </c:when> </c:choose> </td> </tr> <tr> <td> <label>X1 <input type="text" size="4" id="labelX" name="labelX" /></label> <label>Y1 <input type="text" size="4" id="labelY" name="labelY" /></label> <label>X2 <input type="text" size="4" id="labelX2" name="labelX2" /></label> <label>Y2 <input type="text" size="4" id="labelY2" name="labelY2" /></label> <label>W <input type="text" size="4" id="labelW" name="labelW" /></label> <label>H <input type="text" size="4" id="labelH" name="labelH" /></label> </td> </tr> <tr> <td colspan="2"><a href="index.jsp">返回上传图片</a></td> </tr> </table> <input type="hidden" id="x" name="x" /> <input type="hidden" id="y" name="y" /> <input type="hidden" id="x2" name="x2" /> <input type="hidden" id="y2" name="y2" /> <input type="hidden" id="w" name="w" /> <input type="hidden" id="h" name="h" /> <!-- 源图片宽度和高度 --> <input type="hidden" id="width" name="width" value="${param.width}"/> <input type="hidden" id="height" name="height" value="${param.height}"/> <input type="hidden" id="oldImgPath" name="oldImgPath" value="${param.oldImgPath}"/> <input type="hidden" id="imgRoot" name="imgRoot" value="${param.imgRoot}"/> <input type="hidden" id="imgFileExt" name="imgFileExt" value="${param.imgFileExt}"/> </form> </body> </html> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery('#imgCrop').Jcrop({ onChange: showCoords, onSelect: showCoords }); jQuery('#cropButton').click(function(){ var x = jQuery("#x").val(); var y = jQuery("#y").val(); var w = jQuery("#w").val(); var h = jQuery("#h").val(); if(w == 0 || h == 0 ){ alert("您还没有选择图片的剪切区域,不能进行剪切图片!"); return; } alert("你要剪切图片的X坐标: "+x + ",Y坐标: " + y + ",剪切图片的宽度: " + w + ",高度:" + h ); if(confirm("确定按照当前大小剪切图片吗")){ document.form1.submit(); } }); }); function showCoords(c) { jQuery('#x').val(c.x); jQuery('#y').val(c.y); jQuery('#x2').val(c.x2); jQuery('#y2').val(c.y2); jQuery('#w').val(c.w); jQuery('#h').val(c.h); jQuery('#labelX').val(c.x); jQuery('#labelY').val(c.y); jQuery('#labelX2').val(c.x2); jQuery('#labelY2').val(c.y2); jQuery('#labelW').val(c.w); jQuery('#labelH').val(c.h); //显示剪切按键 jQuery('#cropTd').css("display",""); } </script>
4 ImgCropServlet.java(执行图片剪切类)
import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class ImgCropServlet extends HttpServlet { private static final long serialVersionUID = 1L; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("x: " + request.getParameter("x") + "," + request.getParameter("y") + "," + request.getParameter("w") + "," + request.getParameter("h")); // 用户经过剪辑后的图片的大小 Integer x = Integer.parseInt(request.getParameter("x")); Integer y = Integer.parseInt(request.getParameter("y")); Integer w = Integer.parseInt(request.getParameter("w")); Integer h = Integer.parseInt(request.getParameter("h")); //获取原显示图片路径 String oldImgPath = request.getParameter("oldImgPath"); //图片后缀 String imgFileExt = request.getParameter("imgFileExt"); String imgRoot = request.getParameter("imgRoot"); Integer width = Integer.parseInt(request.getParameter("width")); Integer height = Integer.parseInt(request.getParameter("height")); //WEB应用程序根路径 String webAppPath = getServletContext().getRealPath("/"); /**图片名称:以当前日期*/ SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddhhmmss"); String imgFileId = formatter.format(new Date()); String imgName = imgRoot + imgFileId + System.currentTimeMillis() + "." + imgFileExt; //组装图片真实名称 String createImgPath = webAppPath + imgName; //之前上传的图片路径 webAppPath += oldImgPath; System.out.println("原图片路径: " + webAppPath + ",新图片路径: " + createImgPath); //进行剪切图片操作 ImageCut.abscut(webAppPath, createImgPath, x,y,w, h); File f = new File(createImgPath); if(f.exists()){ System.out.println("剪切图片大小: "+w+"*"+h+"图片成功!"); } String path = "/imgcrop.jsp?tag=1&oldImgPath="+oldImgPath+"&imgFileExt="+imgFileExt+"&imgRoot="+imgRoot + "&imgName="+imgName+"&height=" + height + "&width=" + width; System.out.println("imgCrop: " + path); request.getRequestDispatcher(path).forward(request,response); } }
5 ImageCut.java(图片剪切工具类)
import java.io.*; import java.awt.*; import java.awt.image.*; import java.awt.Graphics; import java.awt.color.ColorSpace; import javax.imageio.ImageIO; public class ImageCut { /** * 图像切割(改) * * @param srcImageFile 源图像地址 * @param dirImageFile 新图像地址 * @param x 目标切片起点x坐标 * @param y 目标切片起点y坐标 * @param destWidth 目标切片宽度 * @param destHeight 目标切片高度 */ public static void abscut(String srcImageFile,String dirImageFile, int x, int y, int destWidth, int destHeight) { try { Image img; ImageFilter cropFilter; // 读取源图像 BufferedImage bi = ImageIO.read(new File(srcImageFile)); int srcWidth = bi.getWidth(); // 源图宽度 int srcHeight = bi.getHeight(); // 源图高度 if (srcWidth >= destWidth && srcHeight >= destHeight) { Image image = bi.getScaledInstance(srcWidth, srcHeight, Image.SCALE_DEFAULT); // 改进的想法:是否可用多线程加快切割速度 // 四个参数分别为图像起点坐标和宽高 // 即: CropImageFilter(int x,int y,int width,int height) cropFilter = new CropImageFilter(x, y, destWidth, destHeight); img = Toolkit.getDefaultToolkit().createImage( new FilteredImageSource(image.getSource(), cropFilter)); BufferedImage tag = new BufferedImage(destWidth, destHeight, BufferedImage.TYPE_INT_RGB); Graphics g = tag.getGraphics(); g.drawImage(img, 0, 0, null); // 绘制缩小后的图 g.dispose(); // 输出为文件 ImageIO.write(tag, "JPEG", new File(dirImageFile)); } } catch (Exception e) { e.printStackTrace(); } } /** * 缩放图像 * * @param srcImageFile 源图像文件地址 * @param result 缩放后的图像地址 * @param scale 缩放比例 * @param flag 缩放选择:true 放大; false 缩小; */ public static void scale(String srcImageFile, String result, int scale, boolean flag) { try { BufferedImage src = ImageIO.read(new File(srcImageFile)); // 读入文件 int width = src.getWidth(); // 得到源图宽 int height = src.getHeight(); // 得到源图长 if (flag) { // 放大 width = width * scale; height = height * scale; } else { // 缩小 width = width / scale; height = height / scale; } Image image = src.getScaledInstance(width, height,Image.SCALE_DEFAULT); BufferedImage tag = new BufferedImage(width, height,BufferedImage.TYPE_INT_RGB); Graphics g = tag.getGraphics(); g.drawImage(image, 0, 0, null); // 绘制缩小后的图 g.dispose(); ImageIO.write(tag, "JPEG", new File(result));// 输出到文件流 } catch (IOException e) { e.printStackTrace(); } } /** * 重新生成按指定宽度和高度的图像 * @param srcImageFile 源图像文件地址 * @param result 新的图像地址 * @param _width 设置新的图像宽度 * @param _height 设置新的图像高度 */ public static void scale(String srcImageFile, String result, int _width,int _height) { scale(srcImageFile,result,_width,_height,0,0); } public static void scale(String srcImageFile, String result, int _width,int _height,int x,int y) { try { BufferedImage src = ImageIO.read(new File(srcImageFile)); // 读入文件 int width = src.getWidth(); // 得到源图宽 int height = src.getHeight(); // 得到源图长 if (width > _width) { width = _width; } if (height > _height) { height = _height; } Image image = src.getScaledInstance(width, height,Image.SCALE_DEFAULT); BufferedImage tag = new BufferedImage(width, height,BufferedImage.TYPE_INT_RGB); Graphics g = tag.getGraphics(); g.drawImage(image, x, y, null); // 绘制缩小后的图 g.dispose(); ImageIO.write(tag, "JPEG", new File(result));// 输出到文件流 } catch (IOException e) { e.printStackTrace(); } } /** * 图像类型转换 GIF->JPG GIF->PNG PNG->JPG PNG->GIF(X) */ public static void convert(String source, String result) { try { File f = new File(source); f.canRead(); f.canWrite(); BufferedImage src = ImageIO.read(f); ImageIO.write(src, "JPG", new File(result)); } catch (Exception e) { e.printStackTrace(); } } /** * 彩色转为黑白 * * @param source * @param result */ public static void gray(String source, String result) { try { BufferedImage src = ImageIO.read(new File(source)); ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY); ColorConvertOp op = new ColorConvertOp(cs, null); src = op.filter(src, null); ImageIO.write(src, "JPEG", new File(result)); } catch (IOException e) { e.printStackTrace(); } } }
- jquery.Jcrop-0.9.8.zip (197.4 KB)
- 下载次数: 1171
- jQueryImgCrop_project_.zip (120.1 KB)
- 下载次数: 1893
评论
28 楼
199310290808
2015-12-01
[u][u][u][u][u][u][u][u][u][u]46545646[/u][/u][/u][/u][/u][/u][/u][/u][/u][/u]
27 楼
jialadykiller
2015-08-18
非常感谢
26 楼
当里个当1
2015-07-22
学习了,非常感谢
25 楼
xiajinqian
2015-01-29
很不错,谢谢!
24 楼
913545731lin
2014-12-22
为什么不能下载源码?
23 楼
静坛使者
2014-09-28
hezhoujun 写道
解决了我的难题,谢谢你!想加你的qq成为好友
我可以也加嘛?真的挺好的 代码
22 楼
xiaocaon
2014-09-10
21 楼
zuoguiyefengliu
2014-09-03
abscut方法截取有问题,右边生成黑色边框如何解决??
20 楼
u010272442
2014-06-24
那个,问一下,smart-upload包干啥的啊?
19 楼
大大粒
2014-05-20
你好,请问我想限制选择框的宽和高,请问在哪里限制?
18 楼
hezhoujun
2014-04-02
解决了我的难题,谢谢你!想加你的qq成为好友
17 楼
1807151593
2013-06-14
真心谢谢~~~
16 楼
liuzidong
2012-11-29
工程在附件中呀,直接下载就是了,文章上面也有直接的代码呀
15 楼
majingxia989
2012-11-27
楼主能分享一下工程吗?愁死我了
14 楼
majingxia989
2012-11-27
楼主能分享一下工程吗
13 楼
tiankong6622
2012-09-19
12 楼
king520
2012-08-22
学习下!
11 楼
huakaihualuo1223
2012-08-18
liuzidong 写道
1 我是用的是:0.9.8的版本获取的
2 你可以在js中作个处理吧
2 你可以在js中作个处理吧
多谢楼主,我在java里把小数部分舍弃了,基本没多少影响
10 楼
liuzidong
2012-08-17
1 我是用的是:0.9.8的版本获取的
2 你可以在js中作个处理吧
2 你可以在js中作个处理吧
9 楼
huakaihualuo1223
2012-08-15
liuzidong 写道
Jcrop插件获取的只是整数!具体看它的实现吧!
最新jcrop插件确实可以获得小数,我是做项目的时候遇到了这个问题,出现了异常,你可以试一下截图
发表评论
-
【转载】Eclipse Class Decompiler——Java反编译插件
2018-06-24 11:09 1311参见:jd-eclipse 的安装和使用(最新版的) h ... -
java json-lib & jQuery & jsonp
2016-06-30 11:31 771参考链接: 1、http://hanqunfeng.iteye ... -
Java多线程序源码
2016-06-24 15:04 9851、《Java多线程编程核心技术》源代码(高洪岩) 2、Jav ... -
Spring & Junit
2016-05-27 13:18 7141 测试基类(BaseJunit4Test) import ... -
随机分配算法(Intege)
2016-01-08 13:05 5136参考资料: http://blog.csdn.net/yaer ... -
XSS之xssprotect
2012-12-07 23:03 29344参考资料 1 跨网站脚本 ... -
jQuery图表(jqPlot,Highcharts)
2012-05-18 00:48 23507jQuery图表在http://www.oschina.net ... -
myeclispe之图解weblogic81配置
2011-11-07 10:11 1553一 创建Weblogic81域(如下图) 注意事项:一般 ... -
Java之Thread(线程题)
2011-10-31 12:33 1941特别说明:java线程相关的参考了张孝祥老师的代码 参考资料 ... -
Java之ThreadLocal(Synchronized)
2011-10-31 10:10 2640参考资料 1 深入研究java.lang.ThreadLoca ... -
Java之synchronized,wait,notify结合运用示例
2011-10-26 11:54 5888场景一:要求二个线程各 ... -
Java之synchronized深入应用
2011-10-23 08:03 1904参考资料 1 java synchronized详解 http ... -
jQuery之Ztree
2011-10-19 17:14 17538参考资料 1 spring+struts2+hibernate ... -
jQuery之弹出层(用于提示)
2011-10-19 10:26 2253参考了权威指南的部分代码 实现效果:单击按钮显示层,在单击就 ... -
jQuery之get(txt,xml,json二点注意事项)
2011-10-18 14:42 5656参考资料 1 jQuery ajax - get() 方法 h ... -
jQuery之load
2011-10-17 15:33 7702参考资料 1 jQuery ajax - load() 方法 ... -
JSP:引用文件(绝对路径)
2011-10-17 10:34 24576参考资料 1 SP文件中引用JavaScript文件路径 ht ... -
Java之Timer入门
2011-10-11 15:32 1647参考资料 1 java中timer用 ... -
Java之线程(匿名内部类)
2011-10-10 16:36 163581 Thread对象 Thread t = new Thr ... -
Java之线程(join)
2011-10-10 15:39 1420运用场景:多个线程之间 ...
相关推荐
JAVA实现的图片剪切预览,使用JQUERY控件实现图片的页面裁剪,然后通过JAVA后台实现对图片的剪切处理
头像剪切上传jquery+java源码,uploadimage.jsp为图片上传页面,简单方便实用
js+jquery+java实现的头像上传和裁剪,界面仿百度头像上传样式,完美兼容各种浏览器,集成java上传技术+java图像处理+js剪切图片效果+jquery无刷新上传文件
最近做一个项目的图像上传功能,这个功能就是类似与大型网站的图像上传功能。上传切割主要是相对于起点的四个偏移量,left、top、width、height值,然后在后台进行切割显示给会员。
jQuery-photoClip-master 图片商城剪切,jq,js web开发
jquery上传头像进行图片剪切,尺寸分别为180px*180px/128px*128px/64px*64px
自己通过ajaxfileupload.js结合struts2实现图片上传文件,并通过jcrop和java图像处理功能实现了图片剪切的功能。该功能效果和新浪QQ的头像上传功能效果一样,在ie下可以正常使用 火狐下更换图片时效果样式会走形
java jquery做得一个上传头像的例子 可以剪切头像 设置剪切大小 指定上传路径等
本文介绍了头像裁剪上传功能,用到的技术有 jQuery,springmvc,裁剪插件用的是jcrop(中间遇到很多坑,最终跨越)。 图片上传步骤: 1.用户选择图片 2.将图片传入后台:用户选择图片的时候选择的是各种各样的,...
js+jquery+java实现的头像上传和裁剪,界面仿百度头像上传样式,完美兼容各种浏览器,集成java上传技术+java图像处理+js剪切图片效果+jquery无刷新上传文件
所属分类:计算机 > 软件与程序设计 > JAVA(J#) > Java 编辑推荐 Jworld@TW技术论坛版主,Java权威技术顾问与专业讲师,Java畅销书作者——林信良全新力作。 国内第一本Java 7,前期版本累计销量5万册。 ...
方法2:利用xhEditor提供的jQuery插件接口来实现对特定textarea的初始化和传递参数,例: $('#elm1').xheditor(); 或者 $('#elm1').xheditor({tools:'mini'}); 特别说明:两种初始化方法只能选择其中一种使用,如果...
剪贴板功能:复制,剪切,粘贴,清除 可选的文件和文件夹支持(鼠标拖动和Ctrl键) 对选定文件和文件夹的多种操作支持:移动,删除,下载 之前和之后回调函数的某些操作 双击或单击设置以打开文件和文件夹 延迟加载...
1、 调整图片大小,不走形(FF IE 兼容)/ 剪切图片(overflow:hidden) 2、 控制textarea区域文字数量 3、 点击显示新窗口 4、 input框自动随内容自动变长 5、 添加收藏夹 6、 设置首页 7、 Jquery + Ajax ...