//resize images uploaded to Gravity Form 3. Replace 3 below with form ID

 

add_action("gform_after_submission_3", "gf_resize_images", 10, 2);
function gf_resize_images($entry, $form)
{
//replace 14 with field ID of upload field
$url = $entry[14];
$parsed_url = parse_url($url);
$path = $_SERVER['DOCUMENT_ROOT'] . $parsed_url['path'];
$image = wp_get_image_editor($path);
if ( ! is_wp_error( $image ) )
{
//replace 640,480 with desired dimensions. false indicates not to crop image.
$result = $image->resize( 640,480,false );
$result = $image->save($path);
}
}

per : https://www.gravityhelp.com/forums/topic/image-resize-options

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.