• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Genesis Theme Framework a2z

Genesis Theme Framework a2z

WordPress Dynamic API Reference

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / genesis_get_image_sizes() – Return all registered image sizes arrays, including the standard sizes.

You appear to be a bot. Output may be restricted

Description

Return all registered image sizes arrays, including the standard sizes.

Return a two-dimensional array of standard and additionally registered image sizes, with width, height and crop sub-keys. Here, the standard sizes have their sub-keys populated by pulling from the options saved in the database.

Usage

$array = genesis_get_image_sizes();

Parameters

Returns

array Two-dimensional, with width`, height and `crop sub-keys.

Source

File name: genesis/lib/functions/image.php
Lines:

1 to 41 of 41
function genesis_get_image_sizes() {
  global $_wp_additional_image_sizes;

  
/**
 * Allows controlling the image sizes before running the get_intermediate_image_sizes() logic.
 *
 * The return value must be false or a two-dimensional array with `width`, `height`, and `crop` subkeys.
 *
 * @param bool|array $pre False or genesis_get_image_sizes compatible array.
 */
  $pre = apply_filters( 'genesis_pre_get_image_sizes', false );

  if ( $pre ) {
    return $pre;
  }

  $sizes = [];

  foreach ( get_intermediate_image_sizes() as $size ) {
    if ( isset( $_wp_additional_image_sizes[ $size ] ) ) {
      $sizes[ $size ] = [
        'width'  => absint( $_wp_additional_image_sizes[ $size ]['width'] ),
        'height' => absint( $_wp_additional_image_sizes[ $size ]['height'] ),
        'crop'   => $_wp_additional_image_sizes[ $size ]['crop'],
      ];
    } else {
      $sizes[ $size ] = [
        'width'  => absint( get_option( "{$size}_size_w" ) ),
        'height' => absint( get_option( "{$size}_size_h" ) ),
        'crop'   => (bool) get_option( "{$size}_crop" ),
      ];
    }
  }

  
/**
 * Allows filtering the genesis_get_image_sizes() output.
 *
 * @param array $sizes Two-dimensional, with `width`, `height` and `crop` sub-keys.
 */
  return (array) apply_filters( 'genesis_get_image_sizes', $sizes );
}
 

Published: 25th November 2019 | Last updated: 25th November 2019

Primary Sidebar

Information

Function name: genesis_get_image_sizes
Plugin ref: Genesis Framework
Version: 3.3.5
Sourcefile: lib/functions/image.php
File ref: lib/functions/image.php
Deprecated?: No
API Letters: G,I,S

Footer

Genesis a2z
Genesis Theme Framework a2z
WordPress Dynamic API Reference
WordPress 5.9.3
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  genesis.wp-a2z.org
© Copyright Genesis a2z 2014-2022. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites