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使用方法