analyze_image_in_document

DEPRECATED:

This function is deprecated in HPE Connector Framework Server version 11.1.0 and later. It is still available for existing implementations, but it might be incompatible with new functionality. The function might be removed in future.

HPE recommends using the function analyze_media_in_document instead.

The function analyze_image_in_document performs image analysis on a file associated with a document. CFS adds the results of analysis to the document’s metadata. If analysis is not successful, the function results in a Lua error.

NOTE:

You do not need to add the field AUTN_NEEDS_IMAGE_SERVER_ANALYSIS to the document to use this function.

Syntax

analyze_image_in_document(document, params) 

Arguments

Argument Description
document (Document) The document to analyze. Image analysis is performed on the file associated with the document.
params (table) A table of additional parameters to configure the analysis. The table maps parameter names (String) to parameter values. For information about the parameters that you can set, see the following table. For information about how to use named parameters refer to the HPE Connector Framework Server Administration Guide.

Named Parameters

Named Parameter Description Configuration Parameter
poll_milliseconds (number) The amount of time that HPE CFS waits before polling Image Server to see if an asynchronous request has completed, in milliseconds. The default interval is 5000 milliseconds. ImageAnalysisPollMilliseconds
request_parameters (table) Additional parameters to pass to the Image Server analyze action.  
section (string) The name of a section in the CFS configuration file. If you set this then any parameters not set in the params table are read from this section of the configuration file.  
server (table) A table of additional parameters that configure communication with Image Server. The table maps parameter names (String) to parameter values. For information about the parameters that you can set, see the following table.  
synchronous (Boolean) Specifies whether to send a synchronous request to Image Server (default false). You might want to make the request synchronous when you know that Image Server can process the request quickly (for example, in less than one second). ImageAnalysisSynchronous
taskSections (string) The types of analysis to perform as a comma-separated list. The names that you type must match the names of the analysis tasks that you have configured in your Image Server configuration file. ImageAnalysisTaskSections
transform (string) The filename of an XSL transform. This is applied to the response from Image Server. ImageAnalysisTransform

Image Server Settings

Named Parameter Description Configuration Parameter
section

(string) The name of a section in the CFS configuration file. If you set this then any parameters not set in the server table are read from this section of the configuration file.

If you do not set this parameter, the value of section from the params table is used.

 
host (string) The host name of the machine running Image Server. ImageServerHost
port (Number) The Image Server ACI port. ImageServerPort
retries (Number) The number of times to retry a request to Image Server if the first request fails. ImageServerRetries
timeout (Number) The maximum amount of time that CFS should wait for Image Server to respond, in seconds. ImageServerTimeout
sslSection (string) The name of a section in the CFS configuration file that contains settings for communicating with Image Server over SSL. ImageServerSSLConfig
readFromOriginalLocation

(Boolean) By default, CFS sends files to Image Server over HTTP. If Image Server has direct access to the file, you can set this parameter to true and Image Server will read the file directly. The path of the file is specified by the DREFILENAME document field, or is a path in the CFS working directory if the WorkingDirectory configuration parameter is set.

If you set both readFromOriginalLocation and sharedPath, readFromOriginalLocation takes priority and sharedPath is ignored.

ReadFromOriginalLocation
sharedPath

(string) By default, CFS sends files to Image Server over HTTP. To transfer files to Image Server through a shared folder, set this parameter to the path of the folder.

If you set both readFromOriginalLocation and sharedPath, readFromOriginalLocation takes priority and sharedPath is ignored.

ImageServerSharedPath

Examples

The following Lua script performs image analysis on all documents using the settings in the [ImageServerSettings] section of the CFS configuration file.

function handler(document)
   analyze_image_in_document(document,
        { section="ImageServerSettings" });
   return true;
end

The following example is similar, but overrides the XSL transform and Image Server host set in the configuration file:

function handler(document)
   analyze_image_in_document(document,
        { section = "ImageServerSettings",
          transform = "transform.xsl",
          server = { host="localhost" }
        });
end

_HP_HTML5_bannerTitle.htm