Core Booster Hooks – gfpdf_image_choice_intermediate_size
Description
When displaying Image Choices, Gravity PDF uses either the gform-image-choice-lg
or medium
intermediate size when displaying the media library images in the PDF. You can use this filter to override this value.
note
Not sure what intermediate image sizes are? Kinsta have a comprehensive article that covers the subject in detail.
Arguments
The following arguments are passed to functions that use this hook:
$size | string
- The intermediate size
- The default value is either
gform-image-choice-lg
ormedium
$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 intermediate size and display thumbnails:
add_filter( 'gfpdf_image_choice_intermediate_size', function( $size, $form, $entry, $pdf_settings ) {
return 'thumbnail';
}, 10, 4 );
Only override the image choices size on a specific form and display large images:
add_filter( 'gfpdf_image_choice_intermediate_size', function( $size, $form, $entry, $pdf_settings ) {
if ( (int) $form['id'] !== 20 ) {
return $size;
}
return 'large';
}, 10, 4 );