Image parsing:
If an image field (Image Urls) is parsed, the system will check the type of Url. If the URL starts with either http or https the image will be downloaded and added to the system.
The download is handled by a scheduled job and will happen in the separate thread, it will poll the database DB for blc_media_import_info
records with column is_started=false
.It will download the image, do a transformation if any specified, create the static asset(s), media(s) and link them to entity.
If it doesn't start with http or https, it will be treated as an existing static asset and will link the sku to corresponding media by URL.
Media Field Format
Accepted formats for media is either <key>:<URL> or <URL>. URL can be either from image server or static asset.
Field Value | Description |
---|---|
/path/something.jpg | will be saved with key primary |
mykey:/path/something.jpg | will be saved with mykey as the key |
/path/something.jpg | /path/another.jpg | will be saved as 2 images separated by | with keys - primary for something.jpg and alt1 for another.jpg |
mykey:/path/something.jpg | anotherkey:/path/another.jpg | 2 images with keys: mykey and anotherkey |
Image Download
As mentioned above, images can be stored in an Image Server and downloaded. This is handled by a scheduled job. In order to activate this job, add this entry to your database:
INSERT INTO BLC_SCHED_JOB (SCHED_JOB_ID, CRON_EXPRESSION, ENABLED, EXECUTED, NAME, TYPE, DATE_UPDATED) VALUES (10, '0 0/1 * ? * * *', 1, 0, 'Import image processor', 'IMPORT_IMAGE', now());
Then add this table.
CREATE TABLE blc_media_import_info (
MEDIA_IMPORT_ID BIGINT(20) NOT NULL, MEDIA_URL VARCHAR(255) NULL, CORRELATION_ID VARCHAR(255) NULL, MEDIA_KEY VARCHAR(255) NULL,
ENTITY_ID BIGINT(20) NULL, ENTITY_TYPE VARCHAR(255) NULL, IS_STARTED TINYINT(1) NULL, UPDATED DATETIME NULL, CREATED DATETIME NULL,
ADMIN_USER_ID BIGINT(20) NULL, CATALOG_DISC BIGINT(20) NULL, TARGET_SANDBOX_ID BIGINT(20) NULL, SITE_ID BIGINT(20),
IMPORT_TO_SANDBOX TINYINT(1) NULL,VERSION BIGINT(20), PRIMARY KEY (MEDIA_IMPORT_ID));
Image transformations:
Out of the box ImportFileTransformerService
uses ImageMagic tool, so you have to install it and specify property absolute.path.imageMagick. Check ImageMagic doc for command line tool named "converter", possible doc http://www.imagemagick.org/Usage/resize/
By default no transformations are used. If you need transformations, extend ImportFileTransformerServiceImpl
, override bean blImportFileTransformerService, and override method getTransformationConfigMap to return your transformations. It returns list of map