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 2 times in this file.
| Line | Code |
|---|---|
| 260 | /** |
| 261 | * Filters the GD image resource to be streamed to the browser. |
| 262 | * |
| 263 | * @since 2.9.0 |
| 264 | * @deprecated 3.5.0 Use image_editor_save_pre instead. |
| 265 | * |
| 266 | * @param resource $image Image resource to be streamed. |
| 267 | * @param int $attachment_id The attachment post ID. |
| 268 | */ |
| 269 | $image = apply_filters( 'image_save_pre', $image, $attachment_id ); |
| 270 | |
| 271 | switch ( $mime_type ) { |
| 272 | case 'image/jpeg': |
| 273 | header( 'Content-Type: image/jpeg' ); |
| 274 | return imagejpeg( $image, null, 90 ); |
| 275 | case 'image/png': |
| 276 | header( 'Content-Type: image/png' ); |
| 277 | return imagepng( $image ); |
| 278 | case 'image/gif': |
| Line | Code |
| 317 | |
| 318 | if ( null !== $saved ) |
| 319 | return $saved; |
| 320 | |
| 321 | return $image->save( $filename, $mime_type ); |
| 322 | } else { |
| 323 | _deprecated_argument( __FUNCTION__, '3.5.0', __( '$image needs to be an WP_Image_Editor object' ) ); |
| 324 | |
| 325 | /** This filter is documented in wp-admin/includes/image-edit.php */ |
| 326 | $image = apply_filters( 'image_save_pre', $image, $post_id ); |
| 327 | |
| 328 | /** |
| 329 | * Filters whether to skip saving the image file. |
| 330 | * |
| 331 | * Returning a non-null value will short-circuit the save method, |
| 332 | * returning that value instead. |
| 333 | * |
| 334 | * @since 2.9.0 |
| 335 | * @deprecated 3.5.0 Use wp_save_image_editor_file instead. |