Skip to content

Pre-populate an image on form load

Automatically seed the Image Hopper field with an existing image when the form loads, useful for allowing users to edit or replace a previously uploaded image.

Automatically add an image to Image Hopper on form load:

// Seed the field with an image on page load.
gform.addFilter('image_hopper_filepond_config', function(config, FilePond, $form, currentPage, formId, fieldId, entryId, files, inputField) {
  if(files.length > 0) {
    return config;
  }

  config.files = [
    {
      source: 'https://imagehopper.tech/wp-content/uploads/2021/04/example.png',
      options: {
        type: 'input'
      }
    }
  ];
  return config;
});

Note: Replace the source URL with the actual image URL. Use type: 'input' if you want the image to be reprocessed on every form submission, or type: 'local' if the image should be skipped on resubmit (treated as already processed).