Importing both single and multiple images is supported for the Gallery field.
Download Images Hosted Elsewhere #
For a single image you only need to either enter the image link to use for all imported records, or, map the element from your file that contains each record’s image link:
If importing multiple images to each Gallery, each image link must be separated with two exclamation points:
Use Image(s) Currently Uploaded in /path/to/wpallimport/files #
For a single image you only need to either enter the image filename to use for all imported records, or, map the element from your file that contains each record’s image filename:
If importing multiple images to each Gallery, each image filename must be separated with two exclamation points:
Using FOREACH Style Image Mapping #
If all of the element names are the same for your images elements (such as {img[1]}, {img[2]}, {img[3]}, etc) then you can use the snippet below with your actual element name to import them as required:
[str_replace(“,”,”!!”, {img})]
More advanced mappings are possible for cases where you may have elements that begin with the same name for example. If you have elements named: {image_number_one[1]}, {image_number_two[1]}, {image_number_three[1]}
You could use a snippet like below that only targets the start of each element name to import those:
{./*[starts-with(local-name(), ‘image_number’)]}
These mapping styles will work when downloading images hosted elsewhere or when using images from the /files directory. Just be sure that the required data is returned (links for downloads and filenames for retrieving from /files).