Source
File: wp-admin/includes/media.php
function image_size_input_fields( $post, $check = '' ) {
$size_names = apply_filters(
'image_size_names_choose',
array(
'thumbnail' => __( 'Thumbnail' ),
'medium' => __( 'Medium' ),
'large' => __( 'Large' ),
'full' => __( 'Full Size' ),
)
);
if ( empty( $check ) ) {
$check = get_user_setting( 'imgsize', 'medium' );
}
$out = array();
foreach ( $size_names as $size => $label ) {
$downsize = image_downsize( $post->ID, $size );
$checked = '';
$enabled = ( $downsize[3] || 'full' === $size );
$css_id = "image-size-{$size}-{$post->ID}";
if ( $size == $check ) {
if ( $enabled ) {
$checked = " checked='checked'";
} else {
$check = '';
}
} elseif ( ! $check && $enabled && 'thumbnail' !== $size ) {
$check = $size;
$checked = " checked='checked'";
}
$html = "<div class='image-size-item'><input type='radio' " . disabled( $enabled, false, false ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />";
$html .= "<label for='{$css_id}'>$label</label>";
if ( $enabled ) {
$html .= " <label for='{$css_id}' class='help'>" . sprintf( '(%d × %d)', $downsize[1], $downsize[2] ) . '</label>';
}
$html .= '</div>';
$out[] = $html;
}
return array(
'label' => __( 'Size' ),
'input' => 'html',
'html' => join( "\n", $out ),
);
}