wphooks.info - image_save_pre

image_save_pre

(trunk - 5.0-alpha-43304)

The hook occurs in the following 2 files

wp-admin/includes/image-edit.php:
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
		/**
		 * Filters the GD image resource to be streamed to the browser.
		 *
		 * @since 2.9.0
		 * @deprecated 3.5.0 Use image_editor_save_pre instead.
		 *
		 * @param resource $image         Image resource to be streamed.
		 * @param int      $attachment_id The attachment post ID.
		 */
		$image = apply_filters( 'image_save_pre', $image, $attachment_id );

		switch ( $mime_type ) {
			case 'image/jpeg':
				header( 'Content-Type: image/jpeg' );
				return imagejpeg( $image, null, 90 );
			case 'image/png':
				header( 'Content-Type: image/png' );
				return imagepng( $image );
			case 'image/gif':
wp-admin/includes/image-edit.php:
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
		if ( null !== $saved ) {
			return $saved;
		}

		return $image->save( $filename, $mime_type );
	} else {
		_deprecated_argument( __FUNCTION__, '3.5.0', __( '$image needs to be an WP_Image_Editor object' ) );

		/** This filter is documented in wp-admin/includes/image-edit.php */
		$image = apply_filters( 'image_save_pre', $image, $post_id );

		/**
		 * Filters whether to skip saving the image file.
		 *
		 * Returning a non-null value will short-circuit the save method,
		 * returning that value instead.
		 *
		 * @since 2.9.0
		 * @deprecated 3.5.0 Use wp_save_image_editor_file instead.