• Home
  • Pricing
  • Free Resources
  • About
  • Docs
  • Support
  • Account

Gravity Wiz

Magically enhanced tutorials, snippets and plugins for Gravity Forms!

  • Gravity Perks
    • Gravity Perks
    • Pricing
  • Blog
    • Free Resources
    • About
  • Support
    • Docs
    • Support
    • Account

gpml_merge_tag_image_sizes

  1. Description
  2. Usage
  3. Parameters
  4. Examples
    1. Return All Available Image Sizes For Image Merge Tags
    2. Add A Custom Size
    3. Add A Size to the List
  5. Source Code
  6. Since

Description

By default, GP Media Library will use the default image sizes generated by WordPress (thumbnail, medium, medium_large, large). In addition to these four sizes, the first images registered with add_image_size will also be included.

This filter allows you to modify which sizes are generated for the Image Merge Tags and, if desired, include all of your image sizes.

Usage

add_filter( 'gpml_merge_tag_image_sizes', 'my_custom_function' );

Parameters

  • $sizes array

    An array of image sizes to use with GP Media Library.

Examples

Return All Available Image Sizes For Image Merge Tags

If you would like to return all available image sizes, simply return the get_intermediate_image_sizes function in the filter.

<?php
/**
 * Gravity Perks // Media Library // Return All Available Image Sizes For Image Merge Tags
 * https://gravitywiz.com/documentation/gravity-forms-media-library/
 */
add_filter( 'gpml_merge_tag_image_sizes', function( $sizes ) {
	return get_intermediate_image_sizes();
} );

Add A Custom Size

Looking to replace the default sizes and include only sizes that you specify? Simply return an array of image sizes like so:

<?php
/**
 * Gravity Perks // Media Library // Add A Custom Size
 * https://gravitywiz.com/documentation/gravity-forms-media-library/
 */
add_filter( 'gpml_merge_tag_image_sizes', function( $sizes ) {
	return array( 'image_one', 'image_two' );
} );

Add A Size to the List

Need to add an image size to the list of sizes? Simply add the image size to the array of images sizes like this

<?php
/**
 * Gravity Perks // Media Library // Add A Size to the List
 * https://gravitywiz.com/documentation/gravity-forms-media-library/
 */
add_filter( 'gpml_merge_tag_image_sizes', function( $sizes ) {
	$sizes[] = 'image_one';
} );

Source Code

This filter is located in GP_Media_Library::get_image_merge_tags() in class-gp-media-library.php.

Since

This filter is available since GP Media Library 1.0.4.

All Perks

  • GF Address Autocomplete
  • GF Advanced Calculations
  • GF Advanced Phone Field
  • GF Advanced Save & Continue
  • GF Auto List Field
  • GF Auto Login
  • GF Better User Activation
  • GF Blocklist
  • GF Conditional Logic Dates
  • GF Conditional Pricing
  • GF Copy Cat
  • GF Date Time Calculator
  • GF Disable Entry Creation
  • GF Easy Passthrough
  • GF eCommerce Fields
  • GF Email Users
  • GF Entry Blocks
  • GF Expand Textareas
  • GF File Renamer
  • GF File Upload Pro
  • GF Google Sheets
  • GF Inventory
  • GF Limit Checkboxes
  • GF Limit Choices
  • GF Limit Dates
  • GF Limit Submissions
  • GF Live Preview
  • GF Media Library
  • GF Multi-Page Navigation
  • GF Nested Forms
  • GF Notification Scheduler
  • GF Page Transitions
  • GF Pay Per Word
  • GF PayPal One-time Fee
  • GF Placeholder
  • GF Populate Anything
  • GF Post Content Merge Tags
  • GF Preview Submission
  • GF Price Range
  • GF QR Code
  • GF Randomizer
  • GF Read Only
  • GF Reload Form
  • GF Terms Of Service
  • GF Unique ID
  • GF Word Count

Copyright © 2023 · Powered by WordPress · Gravity Wiz LLC

  • Support
  • Affiliates
  • About
  • Sitemap
  • Terms & Conditions of Use
  • Privacy Policy
  • Cookies Policy