In image_resize(), do not force the destination filename to *.jpg when we are dealing with a *.jpeg.

props SergeyBiryukov.
fixes #16458.



git-svn-id: http://core.svn.wordpress.org/trunk@20701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2012-05-02 20:58:57 +00:00
parent 026289fa33
commit 06c86f519d
1 changed files with 2 additions and 1 deletions

View File

@ -462,6 +462,7 @@ function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $de
return new WP_Error('resize_path_invalid', __( 'Resize path invalid' )); return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
} else { } else {
// all other formats are converted to jpg // all other formats are converted to jpg
if ( 'jpg' != $ext && 'jpeg' != $ext )
$destfilename = "{$dir}/{$name}-{$suffix}.jpg"; $destfilename = "{$dir}/{$name}-{$suffix}.jpg";
if ( !imagejpeg( $newimage, $destfilename, apply_filters( 'jpeg_quality', $jpeg_quality, 'image_resize' ) ) ) 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' ));