[摘要](Bi.getWidth()>120))if (Bi.getHeight()>Bi.getWidth())Ratio = 120.0/Bi.getHeight();elseRatio =...
(Bi.getWidth()>120)){
if (Bi.getHeight()>Bi.getWidth())
Ratio = 120.0/Bi.getHeight();
else
Ratio = 120.0/Bi.getWidth();
}
AffineTransformOp op = new AffineTransformOp(AffineTransform.getScaleInstance(Ratio, Ratio), null);
Itemp = op.filter(Bi, null);
try {
ImageIO.write((BufferedImage)Itemp, ext, ThF);
}catch (Exception ex) {
throw new Exception(" ImageIo.write error in CreatThum.: "+ex.getMessage());
}
return (true);
}
}
该程序由于使用到Java 的AWT,虽然没有显示,但是在linux系统下,程序需要X11 windows的支持.需要安装 XFree86
或XFree86-Xvfb ,加入 export DISPLAY=hostdomain:0.0
为这个问题,我也头疼半天,查询网上类似我这样抱怨很多,既然Java是一次编写,到处运行,好象有点名不副实.
当然也可以使用PJA VNC 或ACME Laboratories 但由于该程序使用到jdk1.4最新的类,估计其他替代产品没有出来,只好作罢.
关键词:ZT 上传图片的缩放处理