External preview generation

External preview generation

External preview generation enables you to create the previews of your media objects using a separate application or with adapted options and not using ImageMagick, as is normally the case in Product 360 - Media Manager.

This function should only be used and configured by administrators. A very thorough knowledge of the system is required to perform the steps described below. We strongly recommend that you do not use external preview generation if you do not possess the requisite technical knowledge.

External preview generation can be used to manage the creation of preview images for any file format for specific customers or all customers.

The formats to be delegated to external preview generation and for which customer(s) are defined in the datatypes.xml file in the directory [Volume0]/opasdata/conf. This directory also includes the file example_datatypes.xml, which contains some sample definitions.

In the file datatypes.xml, you specify which Funcd is to be used to call up an external command for a customer and data format. The value 1 indicates that the Funcd on the file server is used. The file server can be running under Unix or Windows. The value 2 indicates that the Funcd on the second pipeline computer is used. The 2nd pipeline computer runs under Windows.

The external command itself must be specified as a file path from the calling Funcd. This path must not contain any blank spaces or special characters. The command receives three command line parameters from the Funcd.

  • The first parameter is the path from Funcd to the original file. The previews are to be generated from this file. The command called must generate three JPG files from the original file. The first file may be a maximum of 25 x 25 pixels. The second file may be a maximum of 100 x 100 pixels. The third file should be larger than the second file by the factor defined in the Medias settings in the Administration module.

  • The second parameter is the basic name of the files generated.

  • The third path is the absolute path from the Funcd to the directory in which the generated files are stored. The third parameter is specified without a separator at the end.

The Funcd then executes the command, for example: /export/db-main/opastool/TransScript01.sh '/export/buffer/buffer/s79/test.eps' 041109123456 '/export/buffer/buffer/s80'

The shell script TranScript01.sh must generate the files:

  1. /export/buffer/buffer/s80/041109123456_1.jpg with a maximum size of 25x25 pixels

  2. /export/buffer/buffer/s80/041109123456_2.jpg with a maximum size of 100x100 pixels

  3. /export/buffer/buffer/s80/041109123456_3.jpg with a size corresponding to the factor set in the Medias settings in the Administration module

Of course, instead of using a shell script you can also call up a special program or delegate the parameters within a shell script to other programs.

The file paths for the original file and the generated files are case-sensitive.

If Product 360 - Media Manager cannot find one of the three expected files, the corresponding internal preview generation function is used.

Example of the file datatypes.xml

Here is an example of a possible configuration and structure of the file datatypes.xml in the directory [Volume0]/opasdata/conf.

The file datatypes.xml may not contain any comments because the parser used cannot process them.

datatypes.xml
<DEFINITION>
<ENTRY>
<CUSTOMER>D049999</CUSTOMER>
<DATATYPE>.eps</DATATYPE>
<FUNCD>1</FUNCD>
<PROGRAM>/export/opas/buffer_volume/TransScript01.sh</PROGRAM>
</ENTRY>
<ENTRY>
<CUSTOMER>D049999</CUSTOMER>
<DATATYPE>epsf</DATATYPE>
<FUNCD>1</FUNCD>
<PROGRAM>/export/opas/buffer_volume/TranScript01.sh</PROGRAM>
</ENTRY>
<ENTRY>
<CUSTOMER>D049999</CUSTOMER>
<DATATYPE>.tif</DATATYPE>
<FUNCD>2</FUNCD>
<PROGRAM>X:\opas\buffer_volume\TranScript02.bat</PROGRAM>
</ENTRY>
<ENTRY>
<CUSTOMER>D049999</CUSTOMER>
<DATATYPE>tiff</DATATYPE>
<FUNCD>2</FUNCD>
<PROGRAM>X:\opas\buffer_volume\TranScript02.bat</PROGRAM>
</ENTRY>
</DEFINITION>

Example of a shell script

Here is an example of a shell script for external preview generation. This shell script is also located in the file TranScript01.sh in the directory [Volume0]/opasdata/conf.

TranScript01.sh
#!/bin/bash
# Enter the absolute path to the ImageMagick convert command here.
CONV_PATH=/export/opas/volume0/db-main/opastool/funcd/tools/convert
# You can use this value to control the preview quality.
# The default value is 72.
# Lower values generate lower quality previews.
# Higher values generate better quality previews.
CONV_DENS=200
# You can set the width x height size of the small preview in pixels here.
# You should only modify this value slightly, if at all.
SMALL_SIZE=25x25
You can set the width x height size of the medium preview in pixels here.
# You should only modify this value slightly, if at all.
MEDIUM_SIZE=100x100
You can set the width x height size of the large preview in pixels here.
# You should adjust this value to match your settings. Refer to the file example_datatypes.xml.
BIG_SIZE=400x400
# From this point onwards, you do not need to change anything.
SRC=$1
TMP=$3/$2_4.tif
DST1=$3/$2_1.jpg
DST2=$3/$2_2.jpg
DST3=$3/$2_3.jpg
$CONV_PATH -density $CONV_DENS "$SRC" "$TMP[0]"
$CONV_PATH -geometry $SMALL_SIZE "$TMP" "$DST1"
$CONV_PATH -geometry $MEDIUM_SIZE "$TMP" "$DST2"
$CONV_PATH -geometry $BIG_SIZE "$TMP" "$DST3"
rm -f "$TMP"