Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How do I get the height and width of default image sizes? I am not talking about custom image sizes, which can be retrieved from get_intermediate_image_sizes(). I want to get size attribute for 'thumbnail', 'medium', and 'large'.

Update Base on answer by Mridul Aggarwal, looks like i can do:

function get_image_size ($size) {
      return (array(get_option($size. '_size_w'),get_option($size. '_size_h')); 
}

Is this the only way?

share|improve this question
add comment

1 Answer 1

If you want to get those set in the admin panel, use the function get_option. The keys are

get_option('thumbnail_size_w');
get_option('thumbnail_size_h');
get_option('medium_size_w');
get_option('medium_size_h');
get_option('large_size_w');
get_option('large_size_h');

If you want them for some specific attachment, use wp_get_attachment_image_src

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.