#15668 closed enhancement (duplicate)
Add additional image sizes to thickbox
Reported by: | alexkoti | Owned by: | garyc40 |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 3.1 |
Component: | Media | Keywords: | |
Focuses: | Cc: |
Description
Automatically add additional image sizes to thickbox, and provide a hook to filter sizes, in wp-admin/includes/media.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 = array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size')); global $_wp_additional_image_sizes; foreach($_wp_additional_image_sizes as $size_name => $size_name_attr){ $size_names[$size_name] = __($size_name_attr['label']); } $size_names = apply_filters('image_size_names', $size_names); if ( empty($check) ) $check = get_user_setting('imgsize', 'medium');
Add $label to add_image_size() and set_post_thumbnail_size(), in wp-includes/media.php
/** * Registers a new image size */ function add_image_size( $name, $width = 0, $height = 0, $crop = FALSE, $label = FALSE ) { global $_wp_additional_image_sizes; if( empty($label) ) $label = $name; $_wp_additional_image_sizes[$name] = array( 'width' => absint( $width ), 'height' => absint( $height ), 'crop' => !!$crop, 'label' => $label ); } /** * Registers an image size for the post thumbnail */ function set_post_thumbnail_size( $width = 0, $height = 0, $crop = FALSE, $label = FALSE ) { add_image_size( 'post-thumbnail', $width, $height, $crop, $label ); }
Attachments (4)
Change History (18)
#2
@
14 years ago
The functions I pasted alredy patched. Sorry, I am beginner in Trac tools and I dont know how to post diffs.
I added image showing two extras image sizes, labeled 'Custom Image Size Name' and 'Another Image Size'. The labels are added in two functions of 'wp-includes/media.php'
The hook 'image_size_names' filter these sizes before show in page.
#3
@
14 years ago
- Keywords 3.2-early needs-patch added
- Milestone changed from Awaiting Review to Future Release
Makes perfect sense now, especially after reading this tweet: http://twitter.com/bradleypotter/status/10943590733717504.
Sorry, I must have been tired earlier, because it made no sense then. :)
You can learn how to submit patches at http://core.trac.wordpress.org/#HowToSubmitPatches.
#9
@
11 years ago
- Keywords needs-patch added; 3.2-early has-patch removed
Since all the changes of 3.5 this patch isn't valid anymore. Not sure if we can close this ticket in favor of #22100.
#10
@
11 years ago
- Keywords needs-patch removed
- Milestone Future Release deleted
- Resolution set to duplicate
- Status changed from assigned to closed
Duplicate of #24019.
#11
@
11 years ago
- Keywords needs-patch added
- Milestone set to Future Release
Not an exact duplicate, as noted in ticket:24019:2.
I don't see what this is doing.
Use case? Example? What's this an enhancement of?
Please provide a patch.