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.

Way to Auto-Compress Uploaded Images in Gravity?

  1. Our form requires people upload some pictures ~ 4 inside Gravity.
    Just wondering if there is a way to auto compress uploaded images before it sends it out as email. Sometimes the uploaded jpg's are 4MB+ and this is a pain to download.
    ideally we would love to somehow use Yahoo Smush it plugin (already installed in wordpress ) to auto-smush the uploaded images..
    Any suggestions?

    Posted 11 years ago on Monday March 11, 2013 | Permalink
  2. You could use the gform_pre_submission_filter to compress the image, then send the compressed image in the email, rather than the uploaded image.

    http://www.gravityhelp.com/documentation/page/Gform_pre_submission_filter

    Posted 11 years ago on Wednesday March 13, 2013 | Permalink
  3. Hi Chris,

    Thanks for the suggestion.
    I took a look at that method may work.
    Is there any documentation on how that filter can be used to compress image?
    Thx

    Posted 11 years ago on Thursday March 14, 2013 | Permalink
  4. The filter itself does not compress the image. You will need to write a function in PHP to do the image compression (using built in PHP functions or libraries, or to use an external service like smush.it) and then the gform_pre_submission_filter will be used to run your code at the correct time.

    Posted 11 years ago on Thursday March 14, 2013 | Permalink