Package org.nuxeo.ecm.platform.picture.api

Examples of org.nuxeo.ecm.platform.picture.api.ImagingService


        Blob image = (Blob) doc.getPropertyValue(CONTENT_PICTURE_PICTURE_PROPERTY);
        if (image == null) {
            return;
        }

        ImagingService service;
        try {
            service = Framework.getService(ImagingService.class);
        } catch (Exception e) {
            throw new ClientException("Failed to get ImagingService", e);
        }

        ImageInfo info = service.getImageInfo(image);
        int width = info.getWidth();
        int height = info.getHeight();
        float wScale = (float) RESIZED_IMAGE_WIDTH / width;
        float hscale = (float) RESIZED_IMAGE_HEIGHT / height;
        float scale = Math.min(wScale, hscale);

        if (scale < 1) {
            image = service.resize(image, "jpg", (int) (width * scale),
                    (int) (height * scale), info.getDepth());
            image.setMimeType("image/jpeg"); // XXX : Should be automatic
            doc.setPropertyValue(CONTENT_PICTURE_PICTURE_PROPERTY,
                    (Serializable) image);
        }
View Full Code Here

TOP

Related Classes of org.nuxeo.ecm.platform.picture.api.ImagingService

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.