From 43ba2effcdf431cf158492151885026feb3ddce4 Mon Sep 17 00:00:00 2001 From: westi Date: Mon, 2 Mar 2009 21:55:40 +0000 Subject: [PATCH] Allow a plugin to change the jpeg image quality. Fixes #9245 props filosofo. git-svn-id: http://svn.automattic.com/wordpress/trunk@10682 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/image.php | 2 +- wp-includes/media.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php index 8069b97784..4ce468f703 100644 --- a/wp-admin/includes/image.php +++ b/wp-admin/includes/image.php @@ -68,7 +68,7 @@ function wp_crop_image( $src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_ $dst_file = preg_replace( '/\\.[^\\.]+$/', '.jpg', $dst_file ); - if ( imagejpeg( $dst, $dst_file ) ) + if ( imagejpeg( $dst, $dst_file, apply_filters( 'jpeg_quality', 90, 'wp_crop_image' ) ) ) return $dst_file; else return false; diff --git a/wp-includes/media.php b/wp-includes/media.php index 18a8715e44..342da6bebd 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -378,7 +378,7 @@ function image_resize( $file, $max_w, $max_h, $crop=false, $suffix=null, $dest_p else { // all other formats are converted to jpg $destfilename = "{$dir}/{$name}-{$suffix}.jpg"; - if (!imagejpeg( $newimage, $destfilename, apply_filters( 'jpeg_quality', $jpeg_quality ) ) ) + if (!imagejpeg( $newimage, $destfilename, apply_filters( 'jpeg_quality', $jpeg_quality, 'image_resize' ) ) ) return new WP_Error('resize_path_invalid', __( 'Resize path invalid' )); }