Revert [19223] and only stop showing the checkbox, props nacin, see #19174

git-svn-id: http://svn.automattic.com/wordpress/trunk@19225 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2011-11-08 22:34:09 +00:00
parent 3bac0bba44
commit 331b242bcd
4 changed files with 41 additions and 2 deletions

View File

@ -329,6 +329,20 @@ function wp_handle_upload( &$file, $overrides = false, $time = null ) {
if ( false === @ move_uploaded_file( $file['tmp_name'], $tmp_file ) )
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.
$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;
$tmp_file = image_resize( $tmp_file, (int) get_option('large_size_w'), (int) get_option('large_size_h'), 0, 'resized');
if ( ! is_wp_error($tmp_file) ) {
unlink($old_temp);
} else {
$tmp_file = $old_temp;
}
}
// Copy the temporary file into its destination
$new_file = $uploads['path'] . "/$filename";
copy( $tmp_file, $new_file );

View File

@ -78,6 +78,18 @@ function uploadSuccess(fileObj, serverData) {
jQuery('#attachments-count').text(1 * jQuery('#attachments-count').text() + 1);
}
function setResize(arg) {
if ( arg ) {
if ( uploader.features.jpgresize )
uploader.settings['resize'] = { width: resize_width, height: resize_height, quality: 100 };
else
uploader.settings.multipart_params.image_resize = true;
} else {
delete(uploader.settings.resize);
delete(uploader.settings.multipart_params.image_resize);
}
}
function prepareMediaItem(fileObj, serverData) {
var f = ( typeof shortform == 'undefined' ) ? 1 : 2, item = jQuery('#media-item-' + fileObj.id);
// Move the progress bar to 100%
@ -340,7 +352,20 @@ jQuery(document).ready(function($){
uploader_init = function() {
uploader = new plupload.Uploader(wpUploaderInit);
$('#image_resize').bind('change', function() {
var arg = $(this).prop('checked');
setResize( arg );
if ( arg )
setUserSetting('upload_resize', '1');
else
deleteUserSetting('upload_resize');
});
uploader.bind('Init', function(up) {
setResize( getUserSetting('upload_resize', false) );
if ( up.features.dragdrop ) {
$('#plupload-upload-ui').addClass('drag-drop');
$('#drag-drop-area').bind('dragover.wp-uploader', function(){ // dragenter doesn't fire right :(

File diff suppressed because one or more lines are too long

View File

@ -220,7 +220,7 @@ function wp_default_scripts( &$scripts ) {
// cannot use the plupload.full.js, as it loads browserplus init JS from Yahoo
$scripts->add( 'plupload-all', false, array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4'), '1511');
$scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array('plupload-all', 'jquery'), '20111108');
$scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array('plupload-all', 'jquery'), '20111102');
$scripts->localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n );
// keep 'swfupload' for back-compat.