Fix handling of resizing images after upload, props ocean90, see #18206

git-svn-id: http://svn.automattic.com/wordpress/trunk@18517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2011-08-06 21:04:15 +00:00
parent d012143326
commit 9a65f6e237
2 changed files with 6 additions and 3 deletions

View File

@ -330,7 +330,8 @@ function wp_handle_upload( &$file, $overrides = false, $time = null ) {
return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) );
// If a resize was requested, perform the resize.
$do_resize = apply_filters( 'wp_upload_resize', isset( $_REQUEST['image_resize'] ) );
$image_resize = isset( $_POST['image_resize'] ) && 'true' == $_POST['image_resize'];
$do_resize = apply_filters( 'wp_upload_resize', $image_resize );
$size = @getimagesize( $tmp_file );
if ( $do_resize && $size ) {
$old_temp = $tmp_file;

View File

@ -2283,8 +2283,10 @@ function _insert_into_post_button($type) {
*/
function media_upload_max_image_resize() {
?>
<input name="image_resize" type="checkbox" id="image_resize" value="1" />
<label for="image_resize"><?php printf( __( 'Scale images to max width %1$dpx or max height %2$dpx'), get_option('large_size_w'), get_option('large_size_h') ); ?></label>
<label>
<input name="image_resize" type="checkbox" id="image_resize" value="true" />
<?php printf( __( 'Scale images to max width %1$dpx or max height %2$dpx' ), (int) get_option( 'large_size_w' ), (int) get_option( 'large_size_h' ) ); ?>
</label>
<?php
}