Menu Adam R Brown

WP hooks navigation: Home/browse • Actions index • Filters index

Source View: wp_ajax_crop_image_pre_save

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
4033                 *
4034                 * Allows to add filters to modify the way a cropped image is saved.
4035                 *
4036                 * @since 4.3.0
4037                 *
4038                 * @param string $context       The Customizer control requesting the cropped image.
4039                 * @param int    $attachment_id The attachment ID of the original image.
4040                 * @param string $cropped       Path to the cropped image file.
4041                 */
4042                do_action( 'wp_ajax_crop_image_pre_save', $context, $attachment_id, $cropped );
4043
4044                /** This filter is documented in wp-admin/includes/class-custom-image-header.php */
4045                $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication.
4046
4047                $parent_url      = wp_get_attachment_url( $attachment_id );
4048                $parent_basename = wp_basename( $parent_url );
4049                $url             = str_replace( $parent_basename, wp_basename( $cropped ), $parent_url );
4050
4051                $size       = wp_getimagesize( $cropped );