Wordpress 3.5 media uploader api?

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 :slight_smile:

This helped me a lot:

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

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.

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
	});
});

});

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 :slight_smile:

See this Sample Plugin by Thomas Griffin which demonstrates the new stuff:

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 :frowning:
Who faced with such issue?

slamik said

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 :frowning:
Who faced with such issue?

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