PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Image Resize Options

  1. I have created a form for people to upload images and create a post for a photo contest. I would like to be able to ensure people can't upload huge images and was wondering the best way to handle this. I have a few ideas but don't know if they are possbile.

    1) I have installed. Is there a hook or something I can do to enable Imsanity to intercept and process the file upload?

    2) We are holding the generated posts for approval and Imsanity has a bulk image re-size option. We can use this to resize the images before approval but the image size has been placed in the post. Is there a way to prevent the size from being placed in the post.

    3) Is there a way to add custom sizes created in functions.php to the dropdown in the content template options.

    4) Are there any other options I haven't thought of.

    Many Thanks

    Posted 11 years ago on Monday August 27, 2012 | Permalink
  2. I have done some testing using Imsanity and all the other WordPress image sizes are being created but the original image is not being resized.

    I searched in Google and found some older threads here on GF where people have had a plugin resizing the original image. Unfortunately those plugins haven't been updated in more than 2 years.

    Has anyone succeeded in resizing the original image with a current plugin?

    Many Thanks

    Posted 11 years ago on Wednesday August 29, 2012 | Permalink
  3. How about limiting the size of the image they can upload, then rely on WordPress functions for resizing based on your media settings? Here is one user's solution which was posted here:

    Posted 11 years ago on Wednesday August 29, 2012 | Permalink
  4. Thanks for the suggestion Chris. The only problem is not everyone has the knowledge to resize an image. They can take a photo with their 10mp digital camera, go to Walmart and get it printed but ask them to make the image file size smaller so they can upload it for a photo competition is a completely different kettle of fish.

    This plug-in works but it converts the image to grayscale unless you purchase the pro-version and it takes the larger WordPress large image dimensions as the maximum size.

    Imsanity has the facility to set images sizes but it isn't capturing the upload.

    Posted 11 years ago on Wednesday August 29, 2012 | Permalink
  5. I'm not sure if I have a better workaround for this. I'll leave the topic open and see if anyone else has a suggestion.

    Posted 11 years ago on Thursday August 30, 2012 | Permalink
  6. Thanks for your time Chris. I have used Auto Image Resizer for the moment. With some added work with hooks and filters I think it will accomplish what I am after.

    If Imsanity makes an update that will catch the GF images I will probably make the switch.

    Thanks Again!

    Posted 11 years ago on Friday August 31, 2012 | Permalink
  7. I just implemented a pretty straight forward approach to resize images uploaded with Gravity Forms using Wordpress 3.5 image manipulation. Here's the code:

    //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);

    Works like a charm on all forms whether they create a post or not!

    Posted 11 years ago on Monday January 14, 2013 | Permalink
  8. Very nice. Thank you so much for posting that code.

    Posted 11 years ago on Tuesday January 15, 2013 | Permalink
  9. Hi Trestian, its workin too in Wordpress 3.4??

    Posted 11 years ago on Saturday January 19, 2013 | Permalink
  10. @Trestian - Thanks, but as easy as it seems, it's not working for me for some reason.

    I changed the form and field IDs and uploaded in functions.php. What I am missing?

    The only other thing is I have uploaded images going to a different directory from the default GF upload image directory. Will this break the hook?


    Posted 11 years ago on Thursday February 7, 2013 | Permalink
  11. You can find public contact information for trestian on his profile page:

    If you need help with this, please let us know what you're trying to do and maybe we can help make this work or come up with an alternate solution.

    Posted 11 years ago on Friday February 8, 2013 | Permalink
  12. Thanks Trestian this worked perfectly. One less plugin I need.

    Posted 11 years ago on Friday February 8, 2013 | Permalink
  13. anamimosa

    This image resizing solution works great from desktop. Thank you very much for the code.

    For some reason though, the images are not resized when you are using the jetpack mobile theme addon. Also - it seems like the file uploader is having a hard time distinguishing between JPG & jpg.

    Posted 11 years ago on Thursday April 18, 2013 | Permalink