image_size_input_fields [ WordPress Function ]
image_size_input_fields ( $post, $check = '' )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Benzer Fonksiyonlar: image_link_input_fields, image_align_input_fields, sanitize_post_field, get_post_field, image_attachment_fields_to_edit
Retrieve HTML for the size radio buttons with the specified one checked.
Source
<?php
function image_size_input_fields( $post, $check = '' ) {
// get a list of the actual pixel dimensions of each possible intermediate version of this image
$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');
foreach ( $size_names as $size => $label ) {
$downsize = image_downsize($post->ID, $size);
$checked = '';
// is this size selectable?
$enabled = ( $downsize[3] || 'full' == $size );
$css_id = "image-size-{$size}-{$post->ID}";
// if this size is the default but that's not available, don't select it
if ( $size == $check ) {
if ( $enabled )
$checked = " checked='checked'";
else
$check = '';
} elseif ( !$check && $enabled && 'thumbnail' != $size ) {
// if $check is not enabled, default to the first available size that's bigger than a thumbnail
$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>";
// only show the dimensions if that choice is available
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),
);
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- Wordpress Prevent Users from posting full size image uploads ...
The function that creates the size radio buttons is in wp-admin/includes/media. php and is called image_size_input_fields . There's no filter or ...
stackoverflow.com - image_size_input_fields | A HitchHackers guide through WordPress
Feb 12, 2011 ... function image_size_input_fields( $post, $check = '' ) { // get a list of the actual pixel dimensions of each possible intermediate version of this ...
hitchhackerguide.com - WordPress – List all image sizes in Media Uploader ...
Oct 11, 2011 ... However, thanks to the new image_size_names_choose filter added to the image_size_input_fields() function in wp-admin/includes/media.php ...
www.studiograsshopper.ch - WordPress › Support » Thumbnail Image option = Greyed out...2.7 ...
This function is called by wp-admin/includes/media.php-> image_size_input_fields function which checks if the indermediate size is set to true. ( $enabled ...
wordpress.org