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.

Can I edit image dimensions after users has submitted image and form?

  1. jorgeferragut
    Member

    I created a website for an acting agency. For the registration, I used Gravity Forms. One of the fields that must be submitted is a headshot, or picture of the actor.

    So here is my problem: Since Gravity Forms does not allow me to restrict image size, I'm getting alot of people submitting photos of 2-4 MB. These are posted automatically to their corresponding category page ( found here: http://bestfloridatalents.com/?page_id=3)

    Obviously, since people are posting larger files, the download time of this page is very slow.

    I need to be able to change the size of the picture and save it, so it saves to the GravityForm entry. I tried editing the picture in WP Media library, but the change is not reflected in the post... so the photos are still large.

    Here is the site:
    http://bestfloridatalents.com/

    I would really appreciate help with this! This agency website is the reason I bought Gravity Forms, so I would be thankful to make this happen.

    cheers,
    Jorge

    Posted 11 years ago on Saturday December 4, 2010 | Permalink
  2. jorge,
    I can help you with this. What size would you like to resize these photos to?

    Posted 11 years ago on Saturday December 4, 2010 | Permalink
  3. jorgeferragut
    Member

    Awesome Alex! I guess a good size would be something like 300 px wide x 400 px tall.... or in proportion to that (in other words, doesn't have to be exactly that size, just in the range). That's a good size for a portrait layout photo. That may not be the perfect size for a landscape orientation, since it would look smaller.... BUT ideally if I could get a landscape oriented picture to resize proportionately, that would rock.

    I look forward to your comment! Thanks so much again!

    Posted 11 years ago on Saturday December 4, 2010 | Permalink
  4. If you're using the image upload field, you may also be able to use one of the max-size image plugins.

    http://wordpress.org/extend/plugins/max-image-size-control/

    http://wordpress.org/extend/plugins/resize-at-upload/

    I've actually used the second one for some time on a few sites and it works really well.

    Posted 11 years ago on Saturday December 4, 2010 | Permalink
  5. Kevin's second plugin suggestion looks to be the perfect choice for you.

    Posted 11 years ago on Saturday December 4, 2010 | Permalink
  6. jorgeferragut
    Member

    Kevin and Alex - The "resize at upload" plugin worked brilliantly! Thanks so much for the advice and direction.

    Best wishes from Miami,
    Jorge

    Posted 11 years ago on Monday December 6, 2010 | Permalink
  7. Great to hear. Thanks for the update.

    Posted 11 years ago on Monday December 6, 2010 | Permalink
  8. Tzaddi
    Member

    Is it possible to work with the image upload field on a custom field? I need an image in a custom post type and I've got it working through the WP admin panel, but when I setup my gravity form I can only choose the file upload field type (which works and uploads the image, but the "resize at upload" plugin doesn't see it and the image is not resized).

    Any suggestions?
    Thanks

    Posted 11 years ago on Sunday January 30, 2011 | Permalink
  9. Hi Zodzilla,

    This is not possible by default; however, a bit of custom code using the gform_post_submission hook could see this done.

    You'd need to retrieve the the image url from the $entry object which is passed to the gform_post_submission hook as well as the post ID of the created post (also in the $entry object). You could then use the update_post_meta WP function to add the uploaded post image as a custom field as well.

    Posted 11 years ago on Monday January 31, 2011 | Permalink
  10. Tzaddi
    Member

    Perfect, thanks David.

    For anyone else interested, I found that with larger images the Resize on Upload plugin worked better than the Resize at Upload one (and let you set a maximum width & height, not just width).

    http://wordpress.org/extend/plugins/resize-on-upload/

    add_action("gform_post_submission", "post_submission_handler");
    function post_submission_handler($entry){
    	$post_id = $entry['post_id'];
    	$meta_key = 'picture'; // the name of your custom field
    	$photo = explode('|',$entry[6]); // 6 is the ID of Gravity Form field
    	$meta_value = $photo[0]; // the first element in the array is the URL
    	update_post_meta($post_id, $meta_key, $meta_value, $prev_value);
    }
    Posted 11 years ago on Wednesday February 2, 2011 | Permalink
  11. I would like to ad another scenario. I have a section on my site that allows user's to post events. The problem is if the width of the flyers they upload are too wide it breaks the formatting on my site. Now while the resize at upload plugin is an option I usually upload full size images to the site so that when user's click on it or download it they can have a full high res image. If i use that plugin this option would be lost to the user as the width of my site is max 580 before it breaks the formatting.

    That said is there a way to have the width of the image constrained thus also automatically re adjusting the height so that the "Post Image" is the set to the right size and does not break my formatting.

    I have already figured out how to put in the images as well as how to make it so that when they click on it they get the full image however for the image embeded in the body of the article i need the width to be no bigger than 580px wide but i would also like it to adjust the height automatically. Cause if i specify the width manually the height isn't changed.

    Might there be a way to do this. Hope your following what i am saying sorry if i come across confusing.

    Posted 11 years ago on Thursday February 3, 2011 | Permalink
  12. zodzilla and David Smith.
    I have a similar situation where we need have users upload images of items they want to sell. I only want to control the image size of the uploaded images.

    Where do you put in the gform_post_submission code?
    Does this go in my themes functions.php?

    Sorry, ya lost me.

    Posted 11 years ago on Saturday March 5, 2011 | Permalink
  13. Yes, customizations using hooks would go in your functions.php file.

    Posted 11 years ago on Monday March 7, 2011 | Permalink