WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 3 times in this file.
Line | Code |
---|---|
637 | if ( is_array($size) && !empty($imagedata['sizes']) ) { |
638 | $candidates = array(); |
639 |
|
640 | foreach ( $imagedata['sizes'] as $_size => $data ) { |
641 | // If there's an exact match to an existing image size, short circuit. |
642 | if ( $data['width'] == $size[0] && $data['height'] == $size[1] ) { |
643 | list( $data['width'], $data['height'] ) = image_constrain_size_for_editor( $data['width'], $data['height'], $size ); |
644 |
|
645 | /** This filter is documented in wp-includes/media.php */ |
646 | return apply_filters( 'image_get_intermediate_size', $data, $post_id, $size ); |
647 | } |
648 | // If it's not an exact match but it's at least the dimensions requested. |
649 | if ( $data['width'] >= $size[0] && $data['height'] >= $size[1] ) { |
650 | $candidates[ $data['width'] * $data['height'] ] = $_size; |
651 | } |
652 | } |
653 |
|
654 | if ( ! empty( $candidates ) ) { |
655 | // find for the smallest image not smaller than the desired size |
Line | Code |
666 | || ( $maybe_cropped[4] != $data['width'] && $maybe_cropped[4] + 1 != $data['width'] ) |
667 | || ( $maybe_cropped[5] != $data['height'] && $maybe_cropped[5] + 1 != $data['height'] ) |
668 | ) ) { |
669 | continue; |
670 | } |
671 | // If we're still here, then we're going to use this size. |
672 | list( $data['width'], $data['height'] ) = image_constrain_size_for_editor( $data['width'], $data['height'], $size ); |
673 |
|
674 | /** This filter is documented in wp-includes/media.php */ |
675 | return apply_filters( 'image_get_intermediate_size', $data, $post_id, $size ); |
676 | } |
677 | } |
678 | } |
679 |
|
680 | if ( is_array($size) || empty($size) || empty($imagedata['sizes'][$size]) ) |
681 | return false; |
682 |
|
683 | $data = $imagedata['sizes'][$size]; |
684 | // include the full filesystem path of the intermediate file |
Line | Code |
695 | * |
696 | * @see image_get_intermediate_size() |
697 | * |
698 | * @param array $data Array of file relative path, width, and height on success. May also include |
699 | * file absolute path and URL. |
700 | * @param int $post_id The post_id of the image attachment |
701 | * @param string|array $size Registered image size or flat array of initially-requested height and width |
702 | * dimensions (in that order). |
703 | */ |
704 | return apply_filters( 'image_get_intermediate_size', $data, $post_id, $size ); |
705 | } |
706 |
|
707 | /** |
708 | * Gets the available intermediate image sizes. |
709 | * |
710 | * @since 3.0.0 |
711 | * |
712 | * @global array $_wp_additional_image_sizes |
713 | * |