All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.liferay.portal.kernel.image.ImageMagickUtil Maven / Gradle / Ivy

Go to download

Contains interfaces for the portal services. Interfaces are only loaded by the global class loader and are shared by all plugins.

There is a newer version: 156.0.0
Show newest version
/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.liferay.portal.kernel.image;

import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;

import java.util.List;
import java.util.Properties;
import java.util.concurrent.Future;

/**
 * The ImageMagick utility class.
 *
 * @author Alexander Chow
 */
public class ImageMagickUtil {

	/**
	 * Executes the convert command in ImageMagick.
	 *
	 * @param  arguments the command arguments being passed to convert
	 *         
	 * @return the converted command arguments
	 * @throws Exception if an unexpected error occurred while executing command
	 * @see    Convert
	 *         documentation
	 */
	public static Future convert(List arguments) throws Exception {
		return getImageMagick().convert(arguments);
	}

	public static void destroy() {
		getImageMagick().destroy();
	}

	/**
	 * Returns the global search path configured for ImageMagick.
	 *
	 * @return the global search path
	 * @throws Exception if an unexpected error occurred
	 */
	public static String getGlobalSearchPath() throws Exception {
		return getImageMagick().getGlobalSearchPath();
	}

	public static ImageMagick getImageMagick() {
		PortalRuntimePermission.checkGetBeanProperty(ImageMagickUtil.class);

		return _imageMagick;
	}

	/**
	 * Returns the cache and resource usage limits configured for ImageMagick.
	 *
	 * @return the cache and resource usage limits
	 * @throws Exception if an unexpected error occurred
	 */
	public static Properties getResourceLimitsProperties() throws Exception {
		return getImageMagick().getResourceLimitsProperties();
	}

	/**
	 * Executes the identify command in ImageMagick.
	 *
	 * @param  arguments the command arguments being passed to identify
	 *         
	 * @return the results of the identify call
	 * @throws Exception if an unexpected error occurred while executing command
	 * @see    Identify
	 *         documentation
	 */
	public static String[] identify(List arguments) throws Exception {
		return getImageMagick().identify(arguments);
	}

	/**
	 * Returns true if ImageMagick is enabled.
	 *
	 * @return true if ImageMagick is enabled; false
	 *         otherwise
	 */
	public static boolean isEnabled() {
		return getImageMagick().isEnabled();
	}

	/**
	 * Resets the global search path and resource limits for ImageMagick.
	 */
	public static void reset() {
		getImageMagick().reset();
	}

	public void setImageMagick(ImageMagick imageMagick) {
		PortalRuntimePermission.checkSetBeanProperty(getClass());

		_imageMagick = imageMagick;
	}

	private static ImageMagick _imageMagick;

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy