Package at.riemers.zero.base.model

Examples of at.riemers.zero.base.model.Image


   
    }

    public Image findBySource(String sourceId, String resolution) {

        Image source = new Image();
        source.setId(sourceId);
        Criteria c = createCriteria()
                .add(Restrictions.eq("source", source)).add(Restrictions.eq("resolution", resolution));

        List<Image> list = c.list();
        if (list.isEmpty()) return null;
View Full Code Here


        deleteSources(entity);
        super.makeTransient(entity);
    }

    private void deleteSources(Image entity) {
        Image source = new Image();
        source.setId(entity.getId());
        List<Image> list = (List<Image>) createCriteria()
                .add(Restrictions.eq("source", source)).list();
        for (Image i : list) {
            makeTransient(i);
        }
View Full Code Here

            @RequestParam(value = "x", required = false) Integer x,
            @RequestParam(value = "y", required = false) Integer y,
            HttpSession session, HttpServletRequest request) throws Exception {


        Image image = null;
        if (x != null && y != null) {
            try {
                image = imageDao.findBySource(id, "x=" + x + ",y=" + y);
                if (image != null) {
                    log.debug("thumb found");
                }
            } catch (HibernateException hex) {
                log.debug("search image", hex);
            }
        }


        if (image == null) {
            image = imageDao.findById(id);
            if (x != null && y != null) {
                ImageResizer resizer = new ImageResizer();
                Image thumb = new Image();
                thumb.setFileName("th_" + image.getFileName());
                log.debug("resizing image: " + image.getId() + " " + image.getImageBuf().length + " bytes");
                long start = System.currentTimeMillis();
                thumb.setImageBuf(resizer.resize2(image.getImageBuf(), x, y));
                log.debug("... " + (System.currentTimeMillis() - start) / 1000);
                thumb.setResolution("x=" + x + ",y=" + y);
                thumb.setSource(image);
                imageDao.makePersistent(thumb);
                image = thumb;
            }
        }
View Full Code Here

            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);
View Full Code Here

    public ModelAndView swf(
            @RequestParam("id") String id,
            HttpSession session, HttpServletRequest request) throws Exception {


        Image image = null;

        if (image == null) {
            image = imageDao.findById(id);
        }

        Map m = new HashMap();
        m.put("imageData", image.getImageBuf());
        return new ModelAndView(new SwfView(), m);
    }
View Full Code Here

TOP

Related Classes of at.riemers.zero.base.model.Image

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.