<?xml version="1.0" encoding="UTF-8"?>
<editor id="editor.imagick" enabled="false" openable="true" order="11" iconClass="icon-picture" previewProvider="true"
        formId="diaporama_box" text="328" title="329" icon="frame_image.png" className="IMagickPreviewer"
        mimes="pdf,svg,tif,tiff,psd,xcf,eps,xls,xlsx,ods,doc,docx,odt,ppt,pptx,odp,rtf,cr2,ai" label="CONF_MESSAGE[Image Magick]"
        description="CONF_MESSAGE[Image Magick viewer supports PDF and various images formats preview. Requires external library to be installed on the server.]"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd">
    <class_definition filename="plugins/editor.imagick/class.IMagickPreviewer.php" classname="IMagickPreviewer"/>
    <client_settings>
        <resources>
            <js file="plugins/editor.imagick/class.IMagickPreviewer.js" className="IMagickPreviewer"/>
            <i18n namespace="imagick_editor" path="plugins/editor.imagick/i18n"/>
        </resources>
    </client_settings>
	<server_settings>
		<global_param name="IMAGE_MAGICK_CONVERT" type="string" label="CONF_MESSAGE[Convert Path]" description="CONF_MESSAGE[Full path on the server to the 'convert' binary]" default="/usr/bin/convert" mandatory="true"/>
		<global_param name="IM_THUMB_QUALITY" type="string" label="CONF_MESSAGE[Thumbs Options]" description="CONF_MESSAGE[Imagick Options used for generating the thumbnails]" default="-quality 65 -density 150 -resize 250 -flatten"/>
		<global_param name="IM_VIEWER_QUALITY" type="string" label="CONF_MESSAGE[Images Options]" description="CONF_MESSAGE[Imagick Options used for generation the high scale images]" default="-quality 90 -density 250"/>
        <global_param name="IM_CUSTOM_OPTIONS" type="string" label="CONF_MESSAGE[Shared Options]" description="CONF_MESSAGE[You can add any Image Magick options you want here, applied to both thumbs and big images]" default=""/>
        <global_param name="ADDITIONAL_ENV_PATH" type="string" label="CONF_MESSAGE[Environment Path]" description="CONF_MESSAGE[Additional path to put in the environment PATH variable before calling the command. Can be necessary for Ghostscript on Mac for example.]" default=""/>
		<global_param name="ONTHEFLY_THRESHOLD" type="integer" label="CONF_MESSAGE[Pregeneration Threshold]" description="CONF_MESSAGE[Threshold (in MegaByte) under which the pages are all generated when opening the document, and over which pages are generated on-demand only]" default="5"/>
		<global_param name="UNOCONV" type="string" label="CONF_MESSAGE[Unoconv Path]" description="CONF_MESSAGE[Full path on the server to the 'unoconv' binary (see docs)]" default="" mandatory="false"/>
	</server_settings>
	<registry_contributions>
		<hooks>
			<serverCallback hookName="node.change" methodName="deleteImagickCache" defer="true"/>
		</hooks>
		<actions>
			<action name="imagick_data_proxy" contentTypedProvider="true">
				<processing>
					<serverCallback methodName="switchAction" restParams="/file+" developerComment="Serve JPG previews for a PDF or imagick-compatible file.">
                        <input_param name="file" type="AJXP_NODE" description="Path to the file"/>
                        <input_param name="all" type="boolean" description="Whether to pre-extract all pages or pass them one by one"/>
                        <output type="json|jpg" description="Depending on the mode, will return either directly an image (thumbnail), or a json structure containing links to all pages."/>
					</serverCallback>
				</processing>
			</action>
			<action name="delete_imagick_data">
				<processing>
					<serverCallback methodName="switchAction"/>
				</processing>
			</action>
			<action name="get_extracted_page">
				<processing>
					<serverCallback methodName="switchAction" restParams="/file/src_file+" developerComment="Server a prefetched thumbnail for a PDF or imagick compatible file. See imagick_data_proxy.">
                        <input_param name="file" type="string"
                                     description="Name of the page thumbnail, as returned by imagick_data_proxy request"/>
                        <input_param name="src_file" type="AJXP_NODE" description="Path to the original file, if the given page was not yet generated"/>
					</serverCallback>
				</processing>
			</action>
		</actions>
	</registry_contributions>
	<dependencies>
		<pluginResources pluginName="editor.diaporama"/>
		<!-- Stream Wrapper must be implemented -->
		<activePlugin pluginName="access.AJXP_STREAM_PROVIDER"/>
	</dependencies>
</editor>
