public void handle()

in src/main/java/org/apache/sling/thumbnails/internal/transformers/ScaleHandler.java [47:68]


    public void handle(InputStream inputStream, OutputStream outputStream, TransformationHandlerConfig config)
            throws IOException {
        ValueMap properties = config.getProperties();
        double both = properties.get(PN_BOTH, -1.0);
        double width = properties.get(ResizeHandler.PN_WIDTH, -1.0);
        double height = properties.get(ResizeHandler.PN_HEIGHT, -1.0);
        try {
            Builder<? extends InputStream> builder = Thumbnails.of(inputStream);
            if (both >= 0) {
                builder.scale(both);
            } else if (width >= 0 && height >= 0) {
                builder.scale(width, height);
            } else {
                throw new BadRequestException("Could not scale thumbnail, invalid parameters: \n%s", properties);
            }

            builder.toOutputStream(outputStream);
        } catch (IllegalArgumentException e) {
            throw new BadRequestException("Unable to resize due to invalid configuration: \n%s", config.getProperties(),
                    e);
        }
    }