Merge pull request #5544 from splashingpixels/variation-image
return thumb size of variation image on upload
This commit is contained in:
commit
e28055975f
|
@ -324,7 +324,7 @@ jQuery( function ( $ ) {
|
|||
if ( $button.is( '.remove' ) ) {
|
||||
|
||||
setting_variation_image.find( '.upload_image_id' ).val( '' );
|
||||
setting_variation_image.find( 'img' ).attr( 'src', woocommerce_admin_meta_boxes_variations.woocommerce_placeholder_img_src );
|
||||
setting_variation_image.find( 'img' ).eq( 0 ).attr( 'src', woocommerce_admin_meta_boxes_variations.woocommerce_placeholder_img_src );
|
||||
setting_variation_image.find( '.upload_image_button' ).removeClass( 'remove' );
|
||||
|
||||
} else {
|
||||
|
@ -356,11 +356,12 @@ jQuery( function ( $ ) {
|
|||
// When an image is selected, run a callback.
|
||||
variable_image_frame.on( 'select', function () {
|
||||
|
||||
var attachment = variable_image_frame.state().get( 'selection' ).first().toJSON();
|
||||
var attachment = variable_image_frame.state().get( 'selection' ).first().toJSON(),
|
||||
url = attachment.sizes.thumbnail ? attachment.sizes.thumbnail.url : attachment.url;
|
||||
|
||||
setting_variation_image.find( '.upload_image_id' ).val( attachment.id );
|
||||
setting_variation_image.find( '.upload_image_button' ).addClass( 'remove' );
|
||||
setting_variation_image.find( 'img' ).attr( 'src', attachment.url );
|
||||
setting_variation_image.find( 'img' ).eq( 0 ).attr( 'src', url );
|
||||
|
||||
wp.media.model.settings.post.id = wp_media_post_id;
|
||||
});
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue