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 |
|---|---|
| 697 | |
| 698 | /** |
| 699 | * Fires after the header image is set or an error is returned. |
| 700 | * |
| 701 | * @since 2.1.0 |
| 702 | * |
| 703 | * @param string $file Path to the file. |
| 704 | * @param int $attachment_id Attachment ID. |
| 705 | */ |
| 706 | do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication |
| 707 | |
| 708 | return $this->finished(); |
| 709 | } elseif ( $width > $max_width ) { |
| 710 | $oitar = $width / $max_width; |
| 711 | $image = wp_crop_image($attachment_id, 0, 0, $width, $height, $max_width, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file)); |
| 712 | if ( ! $image || is_wp_error( $image ) ) |
| 713 | wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
| 714 | |
| 715 | /** This filter is documented in wp-admin/custom-header.php */ |
| 716 | $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication |
| 717 | |
| 718 | $url = str_replace(basename($url), basename($image), $url); |
| 719 | $width = $width / $oitar; |
| 720 | $height = $height / $oitar; |
| 721 | } else { |
| 722 | $oitar = 1; |
| 723 | } |
| 724 | ?> |
| 725 | |
| Line | Code |
| 849 | elseif ( ! empty( $_POST['create-new-attachment'] ) ) |
| 850 | $cropped = _copy_image_file( $attachment_id ); |
| 851 | else |
| 852 | $cropped = get_attached_file( $attachment_id ); |
| 853 | |
| 854 | if ( ! $cropped || is_wp_error( $cropped ) ) |
| 855 | wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
| 856 | |
| 857 | /** This filter is documented in wp-admin/custom-header.php */ |
| 858 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication |
| 859 | |
| 860 | $parent = get_post($attachment_id); |
| 861 | $parent_url = $parent->guid; |
| 862 | $url = str_replace( basename( $parent_url ), basename( $cropped ), $parent_url ); |
| 863 | |
| 864 | $size = @getimagesize( $cropped ); |
| 865 | $image_type = ( $size ) ? $size['mime'] : 'image/jpeg'; |
| 866 | |
| 867 | // Construct the object array |