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 |
---|---|
206 | $image = apply_filters('image_editor_save_pre', $image, $post_id); |
207 |
|
208 | if ( is_wp_error( $image->stream( $mime_type ) ) ) |
209 | return false; |
210 |
|
211 | return true; |
212 | } else { |
213 | _deprecated_argument( __FUNCTION__, '3.5', __( '$image needs to be an WP_Image_Editor object' ) ); |
214 |
|
215 | $image = apply_filters('image_save_pre', $image, $post_id); |
216 |
|
217 | switch ( $mime_type ) { |
218 | case 'image/jpeg': |
219 | header( 'Content-Type: image/jpeg' ); |
220 | return imagejpeg( $image, null, 90 ); |
221 | case 'image/png': |
222 | header( 'Content-Type: image/png' ); |
223 | return imagepng( $image ); |
224 | case 'image/gif': |
Line | Code |
245 | $saved = apply_filters('wp_save_image_editor_file', null, $filename, $image, $mime_type, $post_id); |
246 |
|
247 | if ( null !== $saved ) |
248 | return $saved; |
249 |
|
250 | return $image->save( $filename, $mime_type ); |
251 | } else { |
252 | _deprecated_argument( __FUNCTION__, '3.5', __( '$image needs to be an WP_Image_Editor object' ) ); |
253 |
|
254 | $image = apply_filters('image_save_pre', $image, $post_id); |
255 | $saved = apply_filters('wp_save_image_file', null, $filename, $image, $mime_type, $post_id); |
256 |
|
257 | if ( null !== $saved ) |
258 | return $saved; |
259 |
|
260 | switch ( $mime_type ) { |
261 | case 'image/jpeg': |
262 | /** This filter is documented in wp-includes/class-wp-image-editor.php */ |
263 | return imagejpeg( $image, $filename, apply_filters( 'jpeg_quality', 90, 'edit_image' ) ); |