mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
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:
parent
3e3cb817f1
commit
43ba2effcd
@ -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;
|
||||
|
@ -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' ));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user