Created
August 6, 2014 19:24
-
-
Save jazzsequence/063cf68e0e61d99c862c to your computer and use it in GitHub Desktop.
get dimensions of an image size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// use the $_wp_additional_image_sizes global to fetch the dimensions of a given image size. | |
// this comes via Otto, who is amazing and knows everything: http://wordpress.stackexchange.com/a/28316 | |
function get_image_size( $size = 'thumbnail' ) { | |
global $_wp_additional_image_sizes; | |
$width = $_wp_additional_image_sizes[$size]['width']; | |
$height = $_wp_additional_image_sizes[$size]['height']; | |
return array( 'width' => $width, 'height' => $height ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment