Skip to main content
Version: v6

Core Booster Hooks – gfpdf_image_choice_width

Description

When displaying Image Choices, images are displayed at a specific pixel width (as defined by the Image Choices Size setting). You can use this filter to override this value.

Arguments

The following arguments are passed to functions that use this hook:

$size | int

  • The image choices size (in pixels)
  • The default value is either 150 200 or 300

$form | array

  • The raw Gravity Forms form array

$entry | array

  • The raw Gravity Forms Entry array.

$pdf_settings | array

  • The current PDF settings being processed

Usage

Override the image choices size and set to 100px:

add_filter( 'gfpdf_image_choice_width', function( $size, $form, $entry, $pdf_settings ) {
return 100; // set the image width to 100px
}, 10, 4 );

Only override the image choices size on a specific form:

add_filter( 'gfpdf_image_choice_width', function( $size, $form, $entry, $pdf_settings ) {
if ( (int) $form['id'] !== 20 ) {
return $size;
}

return 100; // set the image width to 100px on PDFs generated on form ID 20
}, 10, 4 );