Example usage for com.liferay.portal.kernel.image ImageMagickUtil reset

List of usage examples for com.liferay.portal.kernel.image ImageMagickUtil reset

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.image ImageMagickUtil reset.

Prototype

public static void reset() 

Source Link

Document

Resets the global search path and resource limits for ImageMagick.

Usage

From source file:com.liferay.server.admin.web.internal.portlet.action.EditServerMVCActionCommand.java

License:Open Source License

protected void updateExternalServices(ActionRequest actionRequest, PortletPreferences portletPreferences)
        throws Exception {

    boolean imageMagickEnabled = ParamUtil.getBoolean(actionRequest, "imageMagickEnabled");
    String imageMagickPath = ParamUtil.getString(actionRequest, "imageMagickPath");
    boolean xugglerEnabled = ParamUtil.getBoolean(actionRequest, "xugglerEnabled");

    portletPreferences.setValue(PropsKeys.IMAGEMAGICK_ENABLED, String.valueOf(imageMagickEnabled));
    portletPreferences.setValue(PropsKeys.IMAGEMAGICK_GLOBAL_SEARCH_PATH, imageMagickPath);
    portletPreferences.setValue(PropsKeys.XUGGLER_ENABLED, String.valueOf(xugglerEnabled));

    Enumeration<String> enu = actionRequest.getParameterNames();

    while (enu.hasMoreElements()) {
        String name = enu.nextElement();

        if (name.startsWith("imageMagickLimit")) {
            String key = StringUtil.toLowerCase(name.substring(16));
            String value = ParamUtil.getString(actionRequest, name);

            portletPreferences.setValue(PropsKeys.IMAGEMAGICK_RESOURCE_LIMIT + key, value);
        }//ww  w . j  ava2 s.co m
    }

    portletPreferences.store();

    GhostscriptUtil.reset();
    ImageMagickUtil.reset();
}