Uploads: add helper functions for setting, getting, and deleting the temp upload reference used to the attachment_id when retrying to make image sub-sizes.

See #47872.
Built from https://develop.svn.wordpress.org/trunk@46174


git-svn-id: http://core.svn.wordpress.org/trunk@45986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz
2019-09-19 01:26:55 +00:00
parent 308e616baf
commit 463e050b25
8 changed files with 88 additions and 39 deletions

View File

@@ -450,7 +450,7 @@ jQuery( document ).ready( function( $ ) {
data: {
action: 'media-create-image-subsizes',
_wpnonce: _wpPluploadSettings.defaults.multipart_params._wpnonce,
_wp_temp_image_ref: file.id,
_wp_temp_upload_ref: file.id,
_wp_upload_failed_cleanup: true,
}
});
@@ -478,7 +478,7 @@ jQuery( document ).ready( function( $ ) {
data: {
action: 'media-create-image-subsizes',
_wpnonce: wpUploaderInit.multipart_params._wpnonce,
_wp_temp_image_ref: file.id,
_wp_temp_upload_ref: file.id,
_legasy_support: 'true',
}
}).done( function( response ) {
@@ -599,9 +599,9 @@ jQuery( document ).ready( function( $ ) {
*/
uploader.bind( 'BeforeUpload', function( up, file ) {
if ( file.type && file.type.indexOf( 'image/' ) === 0 ) {
up.settings.multipart_params._wp_temp_image_ref = file.id;
up.settings.multipart_params._wp_temp_upload_ref = file.id;
} else {
up.settings.multipart_params._wp_temp_image_ref = '';
up.settings.multipart_params._wp_temp_upload_ref = '';
}
} );
};

File diff suppressed because one or more lines are too long

View File

@@ -138,7 +138,7 @@ window.wp = window.wp || {};
data: {
action: 'media-create-image-subsizes',
_wpnonce: _wpPluploadSettings.defaults.multipart_params._wpnonce,
_wp_temp_image_ref: file.id,
_wp_temp_upload_ref: file.id,
_wp_upload_failed_cleanup: true,
}
});
@@ -161,7 +161,7 @@ window.wp = window.wp || {};
data: {
action: 'media-create-image-subsizes',
_wpnonce: _wpPluploadSettings.defaults.multipart_params._wpnonce,
_wp_temp_image_ref: file.id, // Used to find the new attachment_id.
_wp_temp_upload_ref: file.id, // Used to find the new attachment_id.
}
}).done( function( response ) {
if ( response.success ) {
@@ -324,9 +324,9 @@ window.wp = window.wp || {};
*/
this.uploader.bind( 'BeforeUpload', function( up, file ) {
if ( file.type && file.type.indexOf( 'image/' ) === 0 ) {
up.settings.multipart_params._wp_temp_image_ref = file.id;
up.settings.multipart_params._wp_temp_upload_ref = file.id;
} else {
up.settings.multipart_params._wp_temp_image_ref = '';
up.settings.multipart_params._wp_temp_upload_ref = '';
}
} );

File diff suppressed because one or more lines are too long