WordPress.org

Ready to get started?Download WordPress

Forums

Enhanced Media Library
[resolved] how can we use this plugin features in my custom plugin media uploader (15 posts)

  1. dennisage
    Member
    Posted 10 months ago #

    Hai,

    This is a very useful plugin.It contains all features i expected.This plugin features is applied to add media option inside post creation.But can't used every where i use media uploader.

    I have used media uploader in my custom plugin to upload images from media library.But the dropdown to filter media categories does not appear in media uploader.

    Is it possible to use this plugin other than default Insert media in wordpress??Is there any code to implement this in my custom plugin??

    https://wordpress.org/plugins/enhanced-media-library/

  2. webbistro
    Member
    Plugin Author

    Posted 10 months ago #

    Hi,

    Is there any way to look at your plugin code? In that part where you call media uploader.

    Nadia

  3. dennisage
    Member
    Posted 10 months ago #

    In HTML Form:

    <input id="project_slider_image_button" class="button" type="button" value="Upload Slider Image" />

    Call Media uploader inside custom plugin:

    if (version_compare ( $wp_version, '3.5', '>=' )) {
    define ( 'IS_WP36', true);
    if ( isset( $_GET['page'] ) && ( $_GET['page'] == "create_featuredproject") ) {
    wp_enqueue_media();
    wp_enqueue_script( 'custom-header' );
    }
    }

    Jquery code to upload image using media uploader:

    $('#project_slider_image_button').click(function(e) {
    e.preventDefault();
    var custom_uploader1;
    //If the uploader object has already been created, reopen the dialog
    if (custom_uploader1) {
    custom_uploader1.open();
    return;
    }

    //Extend the wp.media object
    custom_uploader1 = wp.media.frames.file_frame = wp.media({
    title: 'featured project image',
    button: {
    text: 'featured project image'
    },
    multiple: false
    });

    //When a file is selected, grab the URL and set it as the text field's value

    custom_uploader1.on('select', function() {
    var selection = custom_uploader1.state().get('selection');
    selection.map(function(attachment) {
    attachment = attachment.toJSON();
    $('#project_slider_image').val(attachment.id);
    // Do something else with attachment object
    });
    });
    //Open the uploader dialog
    custom_uploader1.open();

    });

  4. dennisage
    Member
    Posted 10 months ago #

    I have specified piece of code from my plugin.Please refer and let me know how to extend this code to use your plugin features in media uploader.

  5. webbistro
    Member
    Plugin Author

    Posted 10 months ago #

    Please let me, also, know if you can see WordPress default filter "All media items" in your custom media uploader.

  6. Teknix
    Member
    Posted 8 months ago #

    Hello Webbistro,

    I am also interested in this functionality as my Theme : Hypershot offers a multiupload for images - where you can also choose from the Media Library. But it does not show the Filtering options, it does neither show the "All Media items" you asked for.

    Do you have any hints for me as to how to integrate your "Filter by Categories" ?

    Btw, I wrote a small php hack for bulk assigning Term Id to Images... but it requires a certain amount of mysql knowledge as you need to get image object ids and term id from database. If you are interested I could send you a version. Maybe you can use the idea ;)

    Greetings

    Teknix

  7. webbistro
    Member
    Plugin Author

    Posted 8 months ago #

    Hi @dennisage,

    You have to use something like this:

    custom_uploader1 = wp.media.frames.file_frame = wp.media({
    	title: 'featured project image',
    	button: {
    		text: 'featured project image'
    	},
    	states: [
    		new wp.media.controller.Library({
    			library:   wp.media.query({ type: 'image' }),
    			multiple:  false,
    			priority:  20,
    			filterable: 'all' // turn on filters
    		})
    	]
    });

    EML will add its filters to any media frame that has any filter.

    Nadia

    p.s. Please use code button (at the top of this editor) to facilitate code reading. Thanks!

  8. webbistro
    Member
    Plugin Author

    Posted 8 months ago #

    Hello @Teknix,

    I considered adding filters to ANY media frame throughout WordPress admin, but then I concluded that it is bad idea. WordPress itself as well as plugins authors have their own reasons to show or not to show filters, so it would be wrong solution.

    If you give me a hint where I can see your theme code I will be able to help you enhance it to have filters for you media frames.

    As for bulk edit functionality. I am totally okay with mySQL, thanks. I wrote a "somehow works" solution about half a year ago. I wasn't satisfied with it because I wanted great scalable and universal solution instead. I had intention to write it in a month or something like, but unfortunately I got a very harsh problem to my backbone. So last few months I have been more concentrated on my health than on my job and plugins.

    At the moment a few guys actually provided some ready solutions, you can find them on this forum. The thing is that I actually didn't have time to learn them. Right now I have finished necessary bug fixing and going to spend all my time to solve bulk edit issue along with adding some new features to the plugin. I think I have my own vision of how it should be implemented, but I will keep your (and others) suggestion in mind. Thank you.

    Nadia

  9. Teknix
    Member
    Posted 8 months ago #

    Hello Nadia,

    thank you very much for your extensive reply! I do agree on the idea of not integrating it everywhere and I will try adding a filter to my theme now... If I cannot succeed with this, I could send you the relevant files per email so that you can maybe help me!
    I have seen you updated the plugin to 1.1 ... Worth updating now?
    Thanks for being so active here although you have back problems - exercise helped me a lot ;)

    Kind greetings and thanks again!

    Teknix

  10. webbistro
    Member
    Plugin Author

    Posted 8 months ago #

    No, but 1.1.1 definitely is :)

    You can provide me access to you dev and explain where you want to see filters. Also take a look at eml-custom-header.js and eml-custom-background.js of v.1.1.1 They are based on native /wp-admin/js/ files.

    Yeah! Yoga is my new boyfriend nowadays )))

  11. Teknix
    Member
    Posted 8 months ago #

    The problem is I am not the author of the theme and I have no real clue, where the relevant dev part is... But I already asked the authors of the theme, you can see here :

    http://support.apollo13.eu/discussion/2287/problem-with-album-multiupload-and-enhanced-media-library#Item_3

    But, I would like to have a look myself before asking more help of you, maybe I can solve the problem myself... I dont know... In theory I only need to add some filter eo enable your plugin in the media library chooser of theme... sounds "feasible" ;)

  12. webbistro
    Member
    Plugin Author

    Posted 8 months ago #

    I think I can give you a hint or two:

    1. it's JS thing, see filterable: 'all' etc
    2. Advanced Custom Fields plugin is perfectly do the job with filters when calling media popup, you can look at its code as well
    3. don't tell theme author that you want EML filters, you want WordPress native filter in his theme, EML filters work in any place where WordPress filter works

    Right now nothing more, it's too late here. Hope, it will help. If not send me access to wordpressuxsolutions [at] gmail [dot] com

  13. Teknix
    Member
    Posted 8 months ago #

    Hi Nadia,

    just uploaded a modified js file to the server with the filterable : 'all' as you wrote, i tried modifiyng the title of the upload window to see if he takes updated script, title is updated but sadly no filters appear :( . I will give you access to theme files tomorrow! Getting late here to ;) . Good night

  14. Teknix
    Member
    Posted 7 months ago #

    Hello Nadia,

    I could not resolve the problem by myself but the Authors of Hypershot say they will fix this to work with your plugin in a update they release soon ! Thanks for your help :)

    Kind greetings,

    Malte

  15. webbistro
    Member
    Plugin Author

    Posted 7 months ago #

    Hello Malte,

    Glad to hear this! You're welcome to ask for help here as well (just in case).

    Nadia

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.