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
This commit is contained in:
westi 2009-03-02 21:55:40 +00:00
parent 3e3cb817f1
commit 43ba2effcd
2 changed files with 2 additions and 2 deletions

View File

@ -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 ); $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; return $dst_file;
else else
return false; return false;

View File

@ -378,7 +378,7 @@ function image_resize( $file, $max_w, $max_h, $crop=false, $suffix=null, $dest_p
else { else {
// all other formats are converted to jpg // all other formats are converted to jpg
$destfilename = "{$dir}/{$name}-{$suffix}.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' )); return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
} }