1、jsp(最好用javabean)怎麼實現生成縮略圖呢?
直接用在頁面上將圖片大小固定或者在圖片載入完之後用js等比例縮放!
2、jsp圖片沒有上傳沒有縮略圖,怎麼回事
jsp產生縮略圖抄: //讀入襲剛才上傳的文件 java.io.File file = new java.io.File(saveurl); //新的縮略圖保存地址 String newurl=request.getRealPath("/")+url+"min_"+filename+"."+ext; //構造Image對象 Image src = javax.imageio.ImageIO.read
3、如何用jsp做縮略圖?
<head>區
<script language="JavaScript">
<!--
function transimg(place) {
if (place==1) imgg.src="0.jpg";
if (place==2) imgg.src="1.jpg";
if (place==3) imgg.src="2.jpg";
}
// -->
</script>
<body>區
<img src="0.jpg" name="imgg"><br>
<span style="cursor:hand" onClick="transimg(1)"><img src="0.jpg"></span>
<span style="cursor:hand" onClick="transimg(2)"><img src="1.jpg"></span>
<span style="cursor:hand" onClick="transimg(3)"><img src="2.jpg"></span>
4、如何用jsp實現 截取上傳的圖片做頭像,並生成小尺寸縮略圖
我有個包,可以在TOMCAT中運行,不過沒有 source code..
要的找我要。
已發送。。
5、JSP頁面選擇本地圖片文件,提交到項目下的一個文件夾里。上傳成功的話JSP頁面上就顯示剛上傳的圖片縮略圖
jsp上傳文件copy你會嗎?如果會,先做上傳。如果不會先學會。
html顯示圖片你會嗎?如果會,那麼將上傳的圖片的地址路徑放到img標簽中的href不就可以了嗎?如果不會先學html<img>標簽。還有什麼問題請 hi我。
6、JSP縮略圖問題
本來就可以縮略顯示啊,看看下面的例子
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
var width = 300; //設置層 寬
var height = 300; // 設置層 高
function init(){
document.all.im.width = width;
document.all.im.height = height;
}
function a( e ){
document.all.im.src = e.src;
document.all.d.style.left = event.x;
document.all.d.style.top = event.y;
document.all.d.style.display = "";
}
function b(){
document.all.d.style.left = 0;
document.all.d.style.top = 0;
document.all.d.style.display = "none";
}
//-->
</SCRIPT>
<BODY onload="init()">
<input type="image" width=100 height=100 src="d:\My Documents\My Pictures\景色6.jpg" onMousemove="a(this)" onmouseout="b()">
<input type="image" width=100 height=100 src="d:\My Documents\My Pictures\景色7.jpg" onMousemove="a(this)" onmouseout="b()">
<input type="image" width=100 height=100 src="d:\My Documents\My Pictures\景色8.jpg" onMousemove="a(this)" onmouseout="b()">
<div id="d" style="position:absolute;left=0;top=0;display:none;border: 1px #FF00FF solid;" >
<input id="im" type="image">
</div>
</BODY>
</HTML>
7、jsp上傳圖片並產生縮略圖的代碼
jsp產生縮略圖:
//讀入剛才上傳的文件
java.io.File file = new java.io.File(saveurl);
//新的縮略圖保存地址
String newurl=request.getRealPath("/")+url+"min_"+filename+"."+ext;
//構造Image對象 Image src = javax.imageio.ImageIO.read(file);
float tagsize=200;
int old_w=src.getWidth(null); //得到源圖寬
int old_h=src.getHeight(null); //得到源圖長
int new_w=0;
int new_h=0;
int temps教程ize;
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);//計算新圖長寬
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();
8、jsp照片牆縮略圖怎麼實現,是有兩套圖嗎
一般來說,是通過你存入資料庫的圖片地址,讀取伺服器的圖片,通過版GUI繪圖,可大可小可權加水印,可編輯,省事的話有插件,jcrop你可以用用試試,網上能下,具體使用包里有demo
http://blog.csdn.net/chenlu123456789/article/details/8834085 gui使用方法