mirror of
git://develop.git.wordpress.org/
synced 2025-02-27 18:13:00 +01:00
Revert [19223] and only stop showing the checkbox, props nacin, see #19174
git-svn-id: https://develop.svn.wordpress.org/trunk@19225 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
5cb7ceeb91
commit
d2d9926055
@ -329,6 +329,20 @@ function wp_handle_upload( &$file, $overrides = false, $time = null ) {
|
|||||||
if ( false === @ move_uploaded_file( $file['tmp_name'], $tmp_file ) )
|
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'] ) );
|
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
|
// Copy the temporary file into its destination
|
||||||
$new_file = $uploads['path'] . "/$filename";
|
$new_file = $uploads['path'] . "/$filename";
|
||||||
copy( $tmp_file, $new_file );
|
copy( $tmp_file, $new_file );
|
||||||
|
@ -78,6 +78,18 @@ function uploadSuccess(fileObj, serverData) {
|
|||||||
jQuery('#attachments-count').text(1 * jQuery('#attachments-count').text() + 1);
|
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) {
|
function prepareMediaItem(fileObj, serverData) {
|
||||||
var f = ( typeof shortform == 'undefined' ) ? 1 : 2, item = jQuery('#media-item-' + fileObj.id);
|
var f = ( typeof shortform == 'undefined' ) ? 1 : 2, item = jQuery('#media-item-' + fileObj.id);
|
||||||
// Move the progress bar to 100%
|
// Move the progress bar to 100%
|
||||||
@ -340,7 +352,20 @@ jQuery(document).ready(function($){
|
|||||||
uploader_init = function() {
|
uploader_init = function() {
|
||||||
uploader = new plupload.Uploader(wpUploaderInit);
|
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) {
|
uploader.bind('Init', function(up) {
|
||||||
|
setResize( getUserSetting('upload_resize', false) );
|
||||||
|
|
||||||
if ( up.features.dragdrop ) {
|
if ( up.features.dragdrop ) {
|
||||||
$('#plupload-upload-ui').addClass('drag-drop');
|
$('#plupload-upload-ui').addClass('drag-drop');
|
||||||
$('#drag-drop-area').bind('dragover.wp-uploader', function(){ // dragenter doesn't fire right :(
|
$('#drag-drop-area').bind('dragover.wp-uploader', function(){ // dragenter doesn't fire right :(
|
||||||
|
File diff suppressed because one or more lines are too long
@ -220,7 +220,7 @@ function wp_default_scripts( &$scripts ) {
|
|||||||
// cannot use the plupload.full.js, as it loads browserplus init JS from Yahoo
|
// 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-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 );
|
$scripts->localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n );
|
||||||
|
|
||||||
// keep 'swfupload' for back-compat.
|
// keep 'swfupload' for back-compat.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user