Aller au contenu

imgs

//get the image size.3
function your_thumbnail_sizes() {
global $_wp_additional_image_sizes;
$sizes = array();
$rSizes = array();
foreach (get_intermediate_image_sizes() as $s) {
$sizes[$s] = array(0, 0);
if (in_array($s, array(‘thumbnail’, ‘medium’, ‘medium_large’, ‘large’))) {
$sizes[$s][0] = get_option($s . ‘_size_w’);
$sizes[$s][1] = get_option($s . ‘_size_h’);
}else {
if (isset($_wp_additional_image_sizes) && isset($_wp_additional_image_sizes[$s]))
$sizes[$s] = array($_wp_additional_image_sizes[$s][‘width’], $_wp_additional_image_sizes[$s][‘height’],);
}
}
foreach ($sizes as $size => $atts) {
$rSizes[$size] = $size . ‘ ‘ . implode(‘x’, $atts);
}
return $rSizes;
}

//get the image size.2
wp_get_registered_image_subsizes();

//get the image size.
$image_sizes = wp_get_additional_image_sizes();
foreach ( $image_sizes as $key => $image_size ) {
echo « {$key} ({$image_size[‘width’]} x {$image_size[‘height’]}) »;
}