Import images from hotfolder to image library

This Action Map imports images from a Windows hotfolder to a Perfion image library and moves imported images to another Windows folder.

This example is provided as inspiration only. It must be adapted to your Perfion environment to work. Perfion Support does not assist with such adaptations. Please contact your Perfion Partner or your Perfion consultant if you need assistance.

Action Map

  • All lines containing a Command are created as virtuals. This is a recommended best practice

  • Images are imported from a Windows folder called ..\Hotfolder\ImageDatabase. You must create this folder manually

  • Images are imported to a feature called ImageDatabase. This is a selectable image feature

  • Image file names are used as keys in import file. This means that a new image in the Windows folder with a file name identical to an existing image in Perfion will overwrite the existing image.

  • The script linked to Name/FileName checks if file to import is actually an image file

  • The File.Move script moves imported images to a Windows folder called ..\Hotfolder\ImageDatabase\Imported.  You must create this folder manually

  • Supported image formats: BMP, GIF, JPG/JPEG, PNG, TIFF/TIF, EPS, PSD, PDF, SVG, WEBP, AVIF

Sample data for building Action Map

NOTE: Line breaks are omitted if you paste scripts from the table below directly to an action. In stead, paste script to Notepad++ and then copy from there. That will preserve line breaks when you paste into an action.

Action Map - From

To

Command

Action

Script

Note

c:\Perfion Data\ActionSources\Hotfolder\ImageDatabase

Files

GET.FILELIST

 

 

 

Files

Images

SELECT

 

 

 

Name

FileName

 

 

string extension = "" + V["Extension"];
bool isImage = Perfion.IsSupportedImageFormat( extension );
Validate.SkipItem( !isImage, "File '{FileName}.{Extension}' is not an image" );

 

FilePath

_Value

 

 

 

 

Images

ImageDatabase

IMPORT

 

 

 

Files

Move

SELECT

 

 

 

Name

 

 

 

File.Move(
Make("{FilePath}")
,Make( @"C:\Perfion Data\ActionSources\Hotfolder\ImageDatabase\Imported\{Name}.{Extension}" )
);