#39583 closed feature request (duplicate)
Add a new function for images: "get_image_size()"
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.8 |
Component: | Media | Keywords: | |
Focuses: | template | Cc: |
Description
We have add_image_size() function but we don't have get_image_size()
Why we need it? So we can know what size in pixels for the specific fetured image settings.
As we know when we can add a featured images settings with specific size in a new theme, for example:
add_image_size( 'featured-small', 800 );
(so we set 800 pixels for a featured-small image)
But when we want later to find this size we can't so we need a new function
get_image_size( 'featured-small' ) that will return the size of 800 so we can know that to do next.
Change History (5)
#1
@
8 years ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
#2
@
8 years ago
Like this:
<?php function get_image_size( $name = '' ) { global $_wp_additional_image_sizes; if ( isset( $_wp_additional_image_sizes[$name] ) ) { return $_wp_additional_image_sizes[$name]; } else { return false; } }
#3
follow-up:
↓ 4
@
8 years ago
NO, no, my ticket is a new function, not improvement for the old one.
Note: See
TracTickets for help on using
tickets.
Hi @alexvorn2, thanks for the ticket!
#18947 already has a patch that introduces
get_image_size()
.