592 posts Don't be so humble - you are not that great.
  • Has referred 10+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+4 more
plusquare says

Houdy mates,

Anyone knows where I can find the new wordpress 3.5 media uploader api? Or something similar I’ve tried to search in the codex but nothing solid comes up :S

Specifically the javascript wp.media.editor functions and handling.

Thanks for any help :)

2028 posts
  • Made it to the Authors' Hall of Fame
  • Had an item featured on Envato Market
  • Provided great feedback to improve the user experience on Envato Market
  • Interviewed on an Envato blog
+9 more
revaxarts says
592 posts Don't be so humble - you are not that great.
  • Has referred 10+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+4 more
plusquare says

The thing is I want something more personalized, I already made this:

//Prepare frame
                    var frame = wp.media({
                        title : 'Pick the images for this work',
                        multiple : true,
                        library : { type : 'image'},
                        button : { text : 'Insert' },
                    });
                    frame.on('close',function() {
                        // get selections and save to hidden input plus other AJAX stuff etc.
                        var selection = frame.state().get('selection');
                        console.log(selection["_byId"]);
                    });
                    frame.on('open',function() {
                        var selection = frame.state().get('selection');

                        //Get ids array from
                        ids = jQuery('#<?php echo $this->id; ?>').val().split(',');
                        ids.forEach(function(id) {
                            attachment = wp.media.attachment(id);
                            attachment.fetch();
                            selection.add( attachment ? [ attachment ] : [] );
                        });
                    });
                    frame.open();

But I wanted to see what I can do with it, was trying to find wp’s actual documentation on this

1 post
  • Has been part of the Envato Community for over 2 years
  • Has collected 1+ items on Envato Market
onyxns says

Thank you plusquare! I like this approach much better than overriding wp.media.editor.send.attachment function. Any idea on how to enable “Attachment Display Settings” in the sidebar? right now only “Attachment Details” is being displayed.

1 post
  • Has been part of the Envato Community for over 4 years
  • Has collected 1+ items on Envato Market
heydays says
Looking for some documentation on this myself. Found an approach for easily fetching attachment-data though:
$('#somelink').on('click', function(event){

event.preventDefault();

var frame = wp.media({
    title: "Select Image",
    multiple: false,
    library: { type: 'image' },
    button : { text : 'add image' }
});
frame.on( 'select', function() {
    var selection = frame.state().get('selection');
    selection.each(function(attachment) {
        console.log(attachment);
        // this will return an object with all the attachment-details
    });
});

});
592 posts Don't be so humble - you are not that great.
  • Has referred 10+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+4 more
plusquare says

In my case I ended up in using admin-ajax get attachment function to display the actual images on the admin as the attachment fetch only functioned after I opened media picker the first time. Got it working exactly as I wanted :)

16 posts
  • Has been part of the Envato Community for over 3 years
  • Has referred 10+ members
  • Has collected 100+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
deckerweb says
See this Sample Plugin by Thomas Griffin which demonstrates the new stuff: https://github.com/thomasgriffin/New-Media-Image-Uploader
2 posts
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
  • Has been part of the Envato Community for over 3 years
  • Located in Ukraine
slamik says

I don’t know why, but “Upload file” don’t whant to work on frontend. Everithing else is ok, I can choose media from library but not to upload :( Who faced with such issue?

2 posts
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
  • Has been part of the Envato Community for over 3 years
  • Located in Ukraine
slamik says

I don’t know why, but “Upload file” don’t whant to work on frontend. Everithing else is ok, I can choose media from library but not to upload :( Who faced with such issue?

I’ve found that jquery select pack cause this issue.

by
by
by
by
by
by