Example usage for com.liferay.portal.kernel.util PropsKeys IMAGEMAGICK_ENABLED

List of usage examples for com.liferay.portal.kernel.util PropsKeys IMAGEMAGICK_ENABLED

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util PropsKeys IMAGEMAGICK_ENABLED.

Prototype

String IMAGEMAGICK_ENABLED

To view the source code for com.liferay.portal.kernel.util PropsKeys IMAGEMAGICK_ENABLED.

Click Source Link

Usage

From source file:com.liferay.portlet.admin.action.EditServerAction.java

License:Open Source License

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

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

    preferences.setValue(PropsKeys.IMAGEMAGICK_ENABLED, String.valueOf(imageMagickEnabled));
    preferences.setValue(PropsKeys.IMAGEMAGICK_GLOBAL_SEARCH_PATH, imageMagickPath);
    preferences.setValue(PropsKeys.OPENOFFICE_SERVER_ENABLED, String.valueOf(openOfficeEnabled));
    preferences.setValue(PropsKeys.OPENOFFICE_SERVER_PORT, String.valueOf(openOfficePort));
    preferences.setValue(PropsKeys.XUGGLER_ENABLED, String.valueOf(xugglerEnabled));

    preferences.store();//  w  w w  .j  av  a2 s . co m

    PDFProcessorUtil.reset();
}

From source file:com.liferay.portlet.documentlibrary.util.PDFProcessorImpl.java

License:Open Source License

public boolean isImageMagickEnabled() throws Exception {
    if (PrefsPropsUtil.getBoolean(PropsKeys.IMAGEMAGICK_ENABLED)) {
        return true;
    }//  w w  w  .j a v  a2 s .  c  o  m

    if (!_warned) {
        StringBundler sb = new StringBundler(5);

        sb.append("Liferay is not configured to use ImageMagick for ");
        sb.append("generating Document Library previews and will default ");
        sb.append("to PDFBox. For better quality previews, install ");
        sb.append("ImageMagick and enable it in portal-ext.properties.");

        _log.warn(sb.toString());

        _warned = true;
    }

    return false;
}

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);
        }/* w  w w  .j ava  2  s .c  om*/
    }

    portletPreferences.store();

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