Advertisements

wp_save_image_file

Definition:
function wp_save_image_file($filename, $image, $mime_type, $post_id) {}

Parameters

  • $filename
  • $image
  • $mime_type
  • $post_id

Defined filters

  • image_save_pre
    apply_filters('image_save_pre', $image, $post_id)
  • wp_save_image_file
    apply_filters('wp_save_image_file', null, $filename, $image, $mime_type, $post_id)
  • jpeg_quality
    apply_filters( 'jpeg_quality', 90, 'edit_image' )

Source code

function wp_save_image_file($filename, $image, $mime_type, $post_id) {

	$image = apply_filters('image_save_pre', $image, $post_id);

	$saved = apply_filters('wp_save_image_file', null, $filename, $image, $mime_type, $post_id);

	if ( null !== $saved )

		return $saved;



	switch ( $mime_type ) {

		case 'image/jpeg':

			return imagejpeg( $image, $filename, apply_filters( 'jpeg_quality', 90, 'edit_image' ) );

		case 'image/png':

			return imagepng($image, $filename);

		case 'image/gif':

			return imagegif($image, $filename);

		default:

			return false;

	}

}

4079

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: