/
Import images from hotfolder to products

Import images from hotfolder to products

This Action Map imports images from a Windows hotfolder to an explicit image feature configured on the Product feature.

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\ProductImages. You must create this folder manually

  • Images are imported to an explicit image-feature called Image. This feature is configured on the Product-feature

  • Image file names are used as keys in import file when imported against Product. This means that image file names must match base value of Products.

  • 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\ProductImages\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\ProductImages

Files

GET.FILELIST

 

 

 

Files

Images

SELECT

 

 

 

Name

_Value

 

 

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

 

FilePath

Image

 

 

 

 

Images

Product

IMPORT

 

 

 

Files

Move

SELECT

 

 

 

Name

 

 

 

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





Related content