By default, Image Hopper displays uploaded images as thumbnails on the Entry Details page. If you prefer to output a list of clickable links instead, use this snippet.
Display images as a list of downloadable links in the Entry Details page:
// Output image links as a bulleted list instead of thumbnails.
add_filter( 'gform_entry_field_value', function ( $value, $field, $entry, $form ) {
if ( $field->type === 'image_hopper' ) {
$field->set_modifiers( [ 'url', 'raw' ] );
$files = $field->get_value_merge_tag( '', '', $entry, $form, '', $entry[ $field->id ], false, false, 'text', false );
$files = explode( ', ', $files );
$html = '<ul>';
foreach ( $files as $file ) {
$html .= '<li><a href="' . esc_url( $field->get_download_url( $file ) ) . '">' . wp_basename( $file ) . '</a></li>';
}
$html .= '</ul>';
return $html;
}
return $value;
}, 10, 4 );
This filter hooks into the gform_entry_field_value action to intercept the display of Image Hopper fields and renders them as a bulleted list of download links instead of thumbnails.
Related
- PHP Actions/Filters — the filter hub
- Store each entry’s images in a separate directory — organize uploaded files