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 |
|---|---|
| 280 | /** |
| 281 | * Filters the GD image resource to be streamed to the browser. |
| 282 | * |
| 283 | * @since 2.9.0 |
| 284 | * @deprecated 3.5.0 Use image_editor_save_pre instead. |
| 285 | * |
| 286 | * @param resource $image Image resource to be streamed. |
| 287 | * @param int $attachment_id The attachment post ID. |
| 288 | */ |
| 289 | $image = apply_filters( 'image_save_pre', $image, $attachment_id ); |
| 290 | |
| 291 | switch ( $mime_type ) { |
| 292 | case 'image/jpeg': |
| 293 | header( 'Content-Type: image/jpeg' ); |
| 294 | return imagejpeg( $image, null, 90 ); |
| 295 | case 'image/png': |
| 296 | header( 'Content-Type: image/png' ); |
| 297 | return imagepng( $image ); |
| 298 | case 'image/gif': |
| Line | Code |
| 340 | if ( null !== $saved ) { |
| 341 | return $saved; |
| 342 | } |
| 343 | |
| 344 | return $image->save( $filename, $mime_type ); |
| 345 | } else { |
| 346 | _deprecated_argument( __FUNCTION__, '3.5.0', __( '$image needs to be an WP_Image_Editor object' ) ); |
| 347 | |
| 348 | /** This filter is documented in wp-admin/includes/image-edit.php */ |
| 349 | $image = apply_filters( 'image_save_pre', $image, $post_id ); |
| 350 | |
| 351 | /** |
| 352 | * Filters whether to skip saving the image file. |
| 353 | * |
| 354 | * Returning a non-null value will short-circuit the save method, |
| 355 | * returning that value instead. |
| 356 | * |
| 357 | * @since 2.9.0 |
| 358 | * @deprecated 3.5.0 Use wp_save_image_editor_file instead. |