1 2 3 4 5 6 7 8 9 10 11 12 13 | 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); } } |
source: https://ithoughtyoucouldusethis.com/resize-image-uploaded-through-gravity-forms/