image_downsize
Filter HookDescription
$possible_sizes = apply_filters( 'image_size_names_choose', array( 'thumbnail' => __( 'Thumbnail' ), 'medium' => __( 'Medium' ), 'large' => __( 'Large' ), 'full' => __( 'Full Size' ), ) ); unset( $possible_sizes['full'] ); /* Loop through all potential sizes that may be chosen. Try to do this with some efficiency. First: run the image_downsize filter. If it returns something, we can use its data. If the filter does not return something, then image_downsize() is just an expensive way to check the image metadata, which we do second.Hook Information
File Location |
wp-includes/media.php
View on GitHub
|
Hook Type | Filter |
Line Number | 4619 |
Hook Parameters
This hook doesn't accept any parameters.
Usage Examples
Basic Usage
<?php
// Hook into image_downsize
add_filter('image_downsize', 'my_custom_filter');
function my_custom_filter() {
// Your custom filtering logic here
return 'modified_value';
}
Source Code Context
wp-includes/media.php:4619
- How this hook is used in WordPress core
<?php
4614 * to check the image metadata, which we do second.
4615 */
4616 foreach ( $possible_sizes as $size => $label ) {
4617
4618 /** This filter is documented in wp-includes/media.php */
4619 $downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size );
4620
4621 if ( $downsize ) {
4622 if ( empty( $downsize[3] ) ) {
4623 continue;
4624 }
PHP Documentation
<?php
/** This filter is documented in wp-admin/includes/media.php */
$possible_sizes = apply_filters(
'image_size_names_choose',
array(
'thumbnail' => __( 'Thumbnail' ),
'medium' => __( 'Medium' ),
'large' => __( 'Large' ),
'full' => __( 'Full Size' ),
)
);
unset( $possible_sizes['full'] );
/*
* Loop through all potential sizes that may be chosen. Try to do this with some efficiency.
* First: run the image_downsize filter. If it returns something, we can use its data.
* If the filter does not return something, then image_downsize() is just an expensive way
* to check the image metadata, which we do second.
*/
Quick Info
- Hook Type: Filter
- Parameters: 0
- File: wp-includes/media.php
Related Hooks
Related hooks will be displayed here in future updates.