Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: image_editor_save_pre

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

This hook occurs 2 times in this file.

Line Code
342
343           /**
344            * Filters the WP_Image_Editor instance for the image to be streamed to the browser.
345            *
346            * @since 3.5.0
347            *
348            * @param WP_Image_Editor $image         The image editor instance.
349            * @param int             $attachment_id The attachment post ID.
350            */
351           $image = apply_filters( 'image_editor_save_pre', $image, $attachment_id );
352
353           if ( is_wp_error( $image->stream( $mime_type ) ) ) {
354                return false;
355           }
356
357           return true;
358      } else {
359           /* translators: 1: $image, 2: WP_Image_Editor */
360           _deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( '%1$s needs to be a %2$s object.' ), '$image', 'WP_Image_Editor' ) );
 
Line Code
415  *     @type int    $height    Image height.
416  *     @type string $mime-type The mime type of the image.
417  *     @type int    $filesize  File size of the image.
418  * }
419  */
420 function wp_save_image_file( $filename, $image, $mime_type, $post_id ) {
421      if ( $image instanceof WP_Image_Editor ) {
422
423           /** This filter is documented in wp-admin/includes/image-edit.php */
424           $image = apply_filters( 'image_editor_save_pre', $image, $post_id );
425
426           /**
427            * Filters whether to skip saving the image file.
428            *
429            * Returning a non-null value will short-circuit the save method,
430            * returning that value instead.
431            *
432            * @since 3.5.0
433            *