if (imageInfo == null) {
imageInfo = imageInfoDao.findById(id);
if (x != null && y != null) {
ImageResizer resizer = new ImageResizer();
ImageMetaInfo thumb = new ImageMetaInfo();
thumb.setFileName("th_" + imageInfo.getFileName());
long start = System.currentTimeMillis();
thumb.setImage(new Image());
thumb.getImage().setImageBuf(resizer.resize2(imageInfo.getImage().getImageBuf(), x, y));
log.debug("... " + (System.currentTimeMillis() - start) / 1000);
thumb.setResolution("x=" + x + ",y=" + y);
thumb.setSource(imageInfo);
imageInfoDao.makePersistent(thumb);
imageInfo = thumb;