3

I want to create an edit media button for my plugin, right now you can easily upload images using the WordPress 3.5 media uploader but I want the user to be able to edit the uploaded images, something like this:

example of uploader

Any ideas on how that can be achieved?

Here is the code that I am using to open the media uploader right now:

    var file_frame;
jQuery('#asp_slides_upload').live('click', function(event){

    event.preventDefault();

    if (file_frame) {
        file_frame.open();
        return;
    }

    file_frame = wp.media.frames.file_frame = wp.media({
        title: jQuery(this).data('uploader_title'),
        button: {
            text: jQuery( this ).data('uploader_button_text'),
        },
        multiple: true
    });

    file_frame.on('select', function() {
        var selection = file_frame.state().get('selection');
        var postID = jQuery('#asp_gallery_id').attr('value');
        attachments = selection.toJSON();
        printableAttachment = JSON.stringify(attachments, null, 2);
        jQuery.ajax({
            type: "POST",
            dataType: "JSON",
            url: aspAdminUrls.ajaxurl,
            data: {
                action: 'asp_save_slides',
                content: attachments,
                postID: postID
            },
            success: function(data) {
                jQuery('#asp_slides_holder').append(data);
            }
        });

    });

    file_frame.open();
});

1 Answer 1

1

I think you are on the same boat with us: http://wordpress.org/extend/ideas/topic/custom-attachment-type

Its not possible easily at the moment. If you and others supports my idea, maybe we will see it for wordpress 3.7

5
  • Is this an answer to the OPs question? Mar 24, 2013 at 13:44
  • Yes. Shortly: not possible easily. And link to idea is explaining why. Mar 24, 2013 at 14:29
  • IMHO, "not possible easily" is a non-answer that translates to "possible, but I don't know / am not going to explain how"... Mar 24, 2013 at 14:52
  • Thank you for your response Ünsal, unfortunately it didnt answer my question. I believe that the new media uploader is intended to work differently as you can only edit the images after you upload them under the attachment post edit screen (you can no longer edit it through the thickbox window). Ill start working on a custom script that allows me to do that in my plugin. Apr 13, 2013 at 16:16
  • Well, i explained way to edit new media panels here: unsalkorkmaz.com/… Maybe it shows you a way. Meanwhile, you can use old media uploader: wordpress.stackexchange.com/questions/81806/… Apr 13, 2013 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.