jspÖÐÉú³ÉͼƬËõÂÔͼµÄ´úÂë
<%@ page contentType="text/html;charset=gb2312" %> <%@ page language="java" import="java.util.*" %> <%@ page language="java" import="java.io.*" %> <%@ page language="java" import="java.awt.*" %> <%@ page language="java" import="java.awt.image.*" %> <%@ page language="java" import="com.sun.image.codec.jpeg.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> </title> <meta name="generator" content="editplus" /> <meta name="author" content="Wang Shiqiang" /> <meta name="keyWords" content="Wang Shiqiang" /> <meta name="description" content="" /> </head> <body> <% response.setContentType("text/html;charset=gb2312"); request.setCharacterEncoding("gb2312"); out.PRint("==================Test for thumbtail picture============="); //-----------------------ÉÏ´«Íê³É£¬¿ªÊ¼Éú³ÉËõÂÔͼ------------------------- java.io.File file = new java.io.File("E:\\1110168154_58348.jpg");//saveurl); //¶ÁÈë¸Õ²ÅÉÏ´«µÄÎļþ String newurl="E:\\\\1110168154_58348_min.jpg";//request.getRealPath("/")+url+filename+"_min."+ext; //еÄËõÂÔͼ±£´æµØÖ· Image src = javax.imageio.ImageIO.read(file); //¹¹ÔìImage¶ÔÏó float tagsize=287; int old_w=src.getWidth(null); //µÃµ½Ô´Í¼¿í int old_h=src.getHeight(null); int new_w=0; int new_h=0; //µÃµ½Ô´Í¼³¤ int tempsize; out.print("<br/>the old width is :"+old_w+" the old height is "+old_h+"<br/>"); float tempdouble; if(old_w>old_h){ tempdouble=old_w/tagsize; }else{ tempdouble=old_h/tagsize; } new_w=Math.round(old_w/tempdouble); new_h=Math.round(old_h/tempdouble);//¼ÆËãÐÂͼ³¤¿í out.print("the new width is :"+new_w+" the new height is "+new_h+"<br/>"); BufferedImage tag = new BufferedImage(new_w,new_h,BufferedImage.TYPE_INT_RGB); tag.getGraphics().drawImage(src,0,0,new_w,new_h,null); //»æÖÆËõСºóµÄͼ FileOutputStream newimage=new FileOutputStream(newurl); //Êä³öµ½ÎļþÁ÷ JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(newimage); encoder.encode(tag); //½üJPEG±àÂë newimage.close(); /* */ %> </body> </html>
ÍƼöÐÅÏ¢
- ÔÝÎ޼Ǽ
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- java urlÖØд¼¼Êõ(UrlReWriter)
- [ת]JavaµÄÊý×飨Array£©¡¢Vector¡¢ArrayLis....
- jsp»·¾³ÏÂajaxÂÒÂëÎÊÌâµÄ½â¾ö
- JSP¼¼Êõ Ö¸Áî ÂÒÂëÎÊÌâ ÔËÐÐÔÀíºÍ¾Å´óÒþʽ¶ÔÏó web¿ª·¢µÄË....
- JAVA ˮӡ ͼƬ ÎÄ×Ö
- java¶þ½øÖÆ£¬ÔÂë¡¢·´Âë¡¢²¹Â롢λÔËËã
- Java WebÓ¦ÓÃÆô¶¯¼ä¸ôÖ´ÐеijÌÐò
- jspÉú³ÉxmlÎļþʾÀý
- javaÖÐÀà±äÁ¿¡¢Àà·½·¨¡¢ÊµÀý±äÁ¿¡¢ÊµÀý·½·¨
- JSPÒ³ÃæµÄÎåÖÖÌøת·½·¨
ÆÀÂÛ