wordpress media uploader window size

i got one issue that im stacked on.
Im running the media uploader window from a colorbox modal window, which i set to 90% width, and inside i have button which trigger the media uploader (opens second window).
but when i trigger it, it everytime opens smaller modal window than the parent colorbox modal.
i think the problem is that my first window is an Iframe and when i trigger another modal, it takes the iframe as main window and by some percentage it makes the second window smaller. this could fix if i know where to set, that the second window should be 100%.

Do you know where can i set the width and height for the window with media uploader? i tried with the “40” value, but it doesnt work. i cant find no documentation for this.
thanks for reply.

Read More

screenshot here: screencast link

my code is

var file_frame1;
jQuery('#mxn_button_add_img1').on('click', function(event) {
    event.preventDefault();
    // If the media frame already exists, reopen it.
    if (file_frame1) {
        file_frame1.open();
        return;
    }

    // Create the media frame.
    file_frame1 = wp.media.frames.file_frame = wp.media({
        title: jQuery(this).data('uploader_title'),
        width: 40,
        button: {
            text: jQuery(this).data('uploader_button_text'),
        },
        multiple: false  // Set to true to allow multiple files to be selected
    });
    // When an image is selected, run a callback.
    // When an image is selected, run a callback.
    file_frame1.on('select', function() {
        var selection = file_frame1.state().get('selection');
        selection.map(function(attachment) {
            attachment = attachment.toJSON();
            jQuery('#mxn_input_img1').val(attachment.url);
            jQuery('#mxn_post_img1').attr('src', attachment.url);
            return false;
        });
    });
});

Related posts

Leave a Reply