What does it do?
GP Media Library enhances Gravity Forms with the ability to automatically import uploaded files (images, documents, etc.) to the WordPress Media Library when the form is submitted.
- Automatically Upload Files to Media Library
A simple, one-click option on your Gravity Forms File Upload fields and any file uploaded from that field will be imported into the WordPress Media Library.
- Single and Multi-file Uploads Supported
Need to upload multiple files at one time? No problem!
- Advanced Custom Fields (ACF) Support
Automatically integrates with any ACF-powered Image or File custom field.
- Display Image Thumbnails
Use auto-generated image merge tags to pull the exact size of the image you’d like to display.
- Seamless, Easy-to-use UI
Integrates directly with Gravity Forms field settings. Activate this feature with a single click.
- Automatic Updates
Get updates and latest features right in your dashboard.
- Awesome Support
We’re here to help! And we mean it.
How do I enable this functionality?
We’ll assume you’re running Gravity Forms 1.9 or greater.
- Install and activate Gravity Perks.
- Install and activate GP Media Library.
- Visit the form where you would like to activate this functionality.
- Open any File Upload field and select the “Perks” tab then select the “Upload to Media Library” option.
- That’s it! Now all files and images will be uploaded to your Media Library from your form when it is submitted.
Image Merge Tags
We also have support for outputting the images uploaded in a File Upload field via merge tags in the Notification Emails and Confirmation Messages.
GP Media Library supports everything supported by Gravity Forms for Post Image merge tags. View Gravity Forms merge tag documentation.
You will find the available merge tags in the GP Media Library section of the Gravity Forms merge tag selector. By default, the four standard WP sizes will be displayed (thumbnail, medium, large, full) and up to four custom sizes per field.
Also, you can modify which image merge tags are available with the gpml_merge_tag_image_sizes hook
Lastly, while merge tags will still display for all File Upload fields, this will only work correctly for images that are uploaded to the field.
Need to integrate this with Advanced Custom Fields? No problem, we have you covered! Check out our article on How to Add Advanced Custom Fields Support for GP Media Library
Here are some examples of how to retrieve the the files and images that are added to the WordPress Media Library by GP Media Library.
One case where this would be useful would be to retrieve the file ID of the image in order to output different sizes of the image that are created by WordPress.
Get File ID’s in a WordPress Template
|$file_ids = gp_media_library()->get_file_ids( $entry_id, $field_id, $file_index );|
Get file ID for a Single File Upload field
|$file_id = gp_media_library()->get_file_ids( 1234, 1 );|
Get file ID’s for a Multi-file Upload field
|$file_ids = gp_media_library()->get_file_ids( 1234, 2 );|
Get file ID of the 2nd file in a Multi-file Upload field
|$file_id = gp_media_library()->get_file_ids( 1234, 2, 1 );|