菜鸟求救 !!求一个类似百度的多图片展示项目

maomohoo 2011-03-23 11:56:15
想做一个作品展示平台,就是像百度这样的先显示缩略图,点击调转后显示详细信息。请高手指教,菜鸟求助
...全文
188 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
yuanxiufang 2011-03-28
  • 打赏
  • 举报
回复
mport java.io.*;
import java.util.*;
import java.awt.*;
import java.awt.image.*;
import javax.imageio.*;
import javax.imageio.stream.*;
import javax.swing.*;

public class FastJpeg {
private ImageReader reader = null;
private BufferedImage bimage = null;
private ImageReadParam param = null;

private int ideal_width = 0;
private int ideal_height = 0;

public FastJpeg(int width, int height) {
ideal_width = width;
ideal_height = height;

Iterator iter = ImageIO.getImageReadersByFormatName("JPEG");
if (iter.hasNext()) {
reader = (ImageReader) iter.next();
} else {
System.out.println("No jpeg reader available!");
}
param = new ImageReadParam();
bimage = new BufferedImage(width, height, 5);
param.setDestination(bimage);
}
public BufferedImage read(String filename)
throws FileNotFoundException, IOException
{
long timea = System.currentTimeMillis();

reader.setInput(new FileImageInputStream(new File(filename)),
false, true);
int w = reader.getWidth(0);
int sampling = w / ideal_width;

param.setSourceSubsampling(sampling, sampling, 0, 0);
BufferedImage ri = reader.read(0, param);

System.out.println("Read took " + (System.currentTimeMillis() - timea)
+ " ms, " + filename);

return(ri);
}
public static void main(String args[]) {
try {
long timea = System.currentTimeMillis();
FastJpeg fast = new FastJpeg(320, 240);

long timeb = System.currentTimeMillis();
Image i = fast.read("test.jpg");
long timec = System.currentTimeMillis();

System.out.println("Time to read image: " + (timec - timeb)
+ ", total time: " + (timec - timea));
} catch (Throwable t) {
t.printStackTrace();
}
}
}
------

import java.io.File;
  import java.io.FileOutputStream;
  import java.awt.Graphics;
  import java.awt.Image;
  import java.awt.image.BufferedImage;
  
  import com.sun.image.codec.jpeg.JPEGCodec;
  import com.sun.image.codec.jpeg.JPEGImageEncoder;
  
  public class JpgTest {
  
  public void JpgTset() throws Exception{
  File _file = new File("/Order005-0001.jpg"); //读入文件
  Image src = javax.imageio.ImageIO.read(_file); //构造Image对象
  int wideth=src.getWidth(null); //得到源图宽
  int height=src.getHeight(null); //得到源图长
  BufferedImage tag = new BufferedImage(wideth/2,height/2,BufferedImage.TYPE_INT_RGB);
  tag.getGraphics().drawImage(src,0,0,wideth/2,height/2,null); //绘制缩小后的图
  FileOutputStream out=new FileOutputStream("newfile.jpg"); //输出到文件流
  JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
  encoder.encode(tag); //近JPEG编码
  //System.out.print(width+"*"+height);
  out.close();
  }
  }
  
技术很好啊!同意楼上的
yuanxiufang 2011-03-28
  • 打赏
  • 举报
回复
CSS code

<style type="text/css">
.product {width:320px; height:150px; border:1px solid #ddd; margin:0 auto; padding:10px;}
.productInfo {width:150px; float:left;}
.productMfr {font:bold 16px/18px a……


很帅
losse 2011-03-28
  • 打赏
  • 举报
回复
用js很好实现的!
maomohoo 2011-03-24
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 lijian8552 的回复:]

CSS code

<style type="text/css">
.product {width:320px; height:150px; border:1px solid #ddd; margin:0 auto; padding:10px;}
.productInfo {width:150px; float:left;}
.productMfr {font:bold 16px/18px a……
[/Quote]
英雄 ,能给具体讲解一下么,第一次弄这东西 路子不是太熟。
maomohoo 2011-03-24
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 c517984604 的回复:]

用js很好实现的!
[/Quote]
能具体点说说么,有点弄不清头绪!
maomohoo 2011-03-24
  • 打赏
  • 举报
回复
木有人能给详细介绍么。。。。比如说 先建数据 然后设定java类 之后怎么着。。。。。。。。。
小蝸牛 2011-03-23
  • 打赏
  • 举报
回复
用js很好实现的!
maomohoo 2011-03-23
  • 打赏
  • 举报
回复
我恨这网络,写个回复刷了N次才能刷出来框框,我就想做成像百度一打开 http://image.baidu.com/i?tn=baiduimage&ct=201326592&cl=2&lm=-1&fr=&fmq=&pv=&ic=0&z=&se=1&showtab=0&fb=0&width=&height=&face=0&istype=2&word=%D7%F7%C6%B7&s=0里面图片的展示 点击单张图片跳转到详细的图片。。。。请高手赐教,
maomohoo 2011-03-23
  • 打赏
  • 举报
回复
大哥们 我想做成这样的
lijian8552 2011-03-23
  • 打赏
  • 举报
回复

<style type="text/css">
.product {width:320px; height:150px; border:1px solid #ddd; margin:0 auto; padding:10px;}
.productInfo {width:150px; float:left;}
.productMfr {font:bold 16px/18px arial, sans-serif; color:#c00; padding:0; margin:0;}
.productType {font:bold 14px/18px arial, sans-serif; color:#000; padding:0; margin:0;}
.features {padding:10px 0; margin:0; list-style:none;}
.features li {font:normal 12px/16px arial, sans-serif; color:#555;}
.price {font:bold 14px/18px arial, sans-serif; color:#00c; padding:0 0 10px 0; margin:0;}

a.clickbox, a.clickbox:visited, a.clickbox:hover {text-decoration:none; text-align:center;}
a.clickbox img {display:block; border:0;}

a.clickbox b {display:block;}
a.clickbox em {font:bold 10px/12px arial,sans-serif; color:#000;}
a.clickbox {float:left; margin:0 15px 15px 0; display:inline;}

a.clickbox .lightbox {position:absolute; left:-9999px; top:-10000px; cursor:default; z-index:500;}

a.clickbox .light {position:absolute; left:0; top:0; width:100%;}
a.clickbox .box {position:absolute; left:0; width:100%; text-align:center; height:300px; top:30%; margin-top:-150px;}
/* trigger for IE6 */
a.clickbox:active {direction:ltr;}

a.clickbox:active .lightbox {left:0; top:0; width:100%; height:100%;}
a.clickbox .lightbox:hover,
a.clickbox:focus .lightbox {position:fixed; left:0; top:0; width:100%; height:100%;}

a.clickbox .lightbox:hover .light,
a.clickbox:active .lightbox .light,
a.clickbox:focus .lightbox .light {background:#fff; width:100%; height:100%; filter: alpha(opacity=90);
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=90); opacity:0.90;
}

a.clickbox .lightbox:hover .box img,
a.clickbox:active .lightbox .box img,
a.clickbox:focus .lightbox .box img {border:1px solid #ddd; margin:0 auto; padding:30px; background:#fff;}

a.clickbox .lightbox:hover .box span,
a.clickbox:active .lightbox .box span,
a.clickbox:focus .lightbox .box span {display:block; width:560px; padding:0; margin:10px auto; text-align:center; text-decoration:none; background:#fff; border:1px solid #ddd;}
a.clickbox .lightbox .box span.title {font:normal 22px/26px verdana, sans-serif; color:#069;}
a.clickbox .lightbox .box span.text {font:normal 11px/16px verdana, sans-serif; color:#333;}

.clear {clear:left;}

a.clickbox i {display:block; width:32px; height:32px; position:fixed; right:-100px; top:0; z-index:500;}

a.clickbox .lightbox:hover i,
a.clickbox:active i,
a.clickbox:focus i {right:50%; top:30%; background:url(close2.png); margin-right:-295px; margin-top:-165px;}

#close {display:block; position:fixed; width:32px; height:32px; right:50%; top:30%; margin-right:-295px; margin-top:-165px; z-index:1000; background:url(trans.gif); cursor:pointer;}


</style>

<!--[if lte IE 6]>


<style type="text/css">
/* to get IE6 to center the Clickbox - adjust the height to cover the whole page */
a.clickbox:active .lightbox {left:50%; margin-left:-2500px; height:2000px; width:5000px;}
a.clickbox:active .lightbox .light {height:2000px;}
a.clickbox i {display:block; width:32px; height:32px; overflow:hidden; float:right; cursor:pointer; position:static; background:url(close.png);}

#close {margin-right:0; margin-top:0; z-index:1000; background:url(trans.gif); cursor:pointer;}
a.clickbox .lightbox:hover i,
a.clickbox:active i {right:32px; top:32px; background:url(close.png); margin-right:0; margin-top:0; background:url(close.png);}

a.clickbox .frame {width:500px; height:300px; background:#fff; border:1px solid #000; padding:10px;}
a.clickbox .box {top:5%; margin-top:0;}
</style>
<![endif]-->




<div class="product">
<a class="clickbox" href="#url">
<img src="eos500d-thumb.jpg" alt="" title="Click for larger image" />
<em>• large image •</em>
<b class="lightbox">
<b class="light"></b>
<b class="box">
<img src="eos500d.jpg" alt="" />
<span class="title">It's your vision - make it count</span>
<span class="text">With the EOS 500D, every side of your story comes alive. Capture every detail in stunning 15.1 Megapixel resolution, or switch to shooting pin-sharp Full High Definition video.<br /><i></i></span>
</b>
</b>
</a>
<div class="productInfo">
<p class="productMfr">Canon EOS 500D</p>
<p class="productType">Digital SLR Camera</p>
<ul class="features">
<li>• 15.1 MP CMOS sensor</li>
<li>• Full HD (1080p) movies</li>
</ul>
<p class="price">£470</p>
<img src="cart.gif" alt="Checkout" />
</div>
</div>
<div id="close"></div>



G_beginner 2011-03-23
  • 打赏
  • 举报
回复
嗯 应该就是用js吧 jQuery有这样的插件的
e生态_修身 2011-03-23
  • 打赏
  • 举报
回复
可以采用js的方式使用

81,095

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧