WP Real Media Library

Structurize your Uploads!


Thank you for buying this powerful plugin!

To get started, just install the included plugin in your downloaded file from envato market.

  1. Take a cup of coffee
  2. Log in your wordpress site as admin
  3. Goto Plugins > Install > Upload Plugin
  4. Browse your downloaded file and select real-media-library.zip
  5. Upload and activate!
  6. Finish, you can use the plugin immediately!

Ohh... The cup is still full... It's so fast to make the plugin ready to use.

Creating a folder is so easy. Goto your media library in wordpress backend. On the left side you will se your structure. There are three types of folders:

In the list or grid view you can simply move the files per drag & drop (mouse). Also you can bulk select your files and move, so simple.

Otherwise you can go to the attachment edit window and change the "Folder"-Meta.

Currently there are options available:

  • Settings > Media > Real Media Library: Hide upload prevew = Check this, if you want to hide the upload preview image. Recommanded for slow loading netbooks / notebooks / browsers.
  • Settings > Media > Real Media Library: Allow all folders for folder gallery = Check this, if all folders (not collections) should be selectable in the folder gallery dialog.
  • In the following are several PHP functions to handle with RML (Real Media Library). This functions are located in /inc/api/api.php. If you want to handle with RML_Folder objects, have a look at /inc/attachment/Folder.class.inc.

    Dropdowns

    /**
     * This functions returns a HTML formatted string which contains
     *  elements with all folders, collections and galleries.
     * 
     * @param $selected The selected item
     *              "": "All Files"
     *              -1: "Root"
     *              int: Folder ID
     * @param $disabled array Defines, which folder types are disabled (@see ./real-media-library.php for Constant-Types)
     *                        Default disabled is RML_TYPE_COLLECTION
     * @param $useAll boolean Defines, if "All Files" should be showed
     * @return String
     */
    wp_rml_dropdown($selected, $disabled, $useAll = true);

    Note: This functions returns a string with <option>. You will have to wrap it with <select>


    /**
     * This functions returns a HTML formatted string which contains
     *  elements with all folders, collections and galleries.
     * Note: Only COLLECTIONS are SELECTABLE!
     * 
     * @param $selected The selected item
     *              "": "All Files"
     *              -1: "Root"
     *              int: Folder ID
     * @return String
     */
    wp_rml_dropdown_collection($selected);

    Note: This functions returns a string with <option>. You will have to wrap it with <select>


    /**
     * This functions returns a HTML formatted string which contains
     *  elements with all folders, collections and galleries.
     * Note: Only GALLERIES are SELECTABLE!
     * 
     * @param $selected The selected item
     *              "": "All Files"
     *              -1: "Root"
     *              int: Folder ID
     * @return String
     */
    wp_rml_dropdown_gallery($selected);

    Note: This functions returns a string with <option>. You will have to wrap it with <select>


    /**
     * This functions returns a HTML formatted string which contains
     *  elements with all folders, collections and galleries.
     * Note: Only GALLERIES AND COLLECTIONS are SELECTABLE!
     * 
     * @param $selected The selected item
     *              "": "All Files"
     *              -1: "Root"
     *              int: Folder ID
     * @return String
     */
    wp_rml_dropdown_gallery_or_collection($selected);

    Note: This functions returns a string with <option>. You will have to wrap it with <select>


    Get RML_Folder object

    /**
     * This functions checks if a specific folder exists by ID and is
     * a given allowed RML Folder Type.
     * 
     * @param $id int Folder ID
     * @param $allowed array Defines, which folder types are allowed (@see ./real-media-library.php for Constant-Types)
     *                       If it is null, all folder types are allowed.
     * @return RML_Folder object or NULL
     * 
     * Note: The Folder ID must be a valid Folder ID, not Root and "All Files" => FolderID > -1
     */
    wp_rml_get_by_id($id, $allowed = null);
    /**
     * This functions checks if a specific folder exists by absolute path and is
     * a given allowed RML Folder Type.
     * 
     * @param $path string Folder Absolute Path
     * @param $allowed array Defines, which folder types are allowed (@see ./real-media-library.php for Constant-Types)
     *                       If it is null, all folder types are allowed.
     * @return RML_Folder object or NULL
     * 
     * Note: The absolute path may not be "/" (Root).
     */
    wp_rml_get_by_absolute_path($path, $allowed = null);
    /**
     * Determines, if a Folder is a special folder type.
     * 
     * @param $folder RML_Folder
     * @param $allowed array Defines, which folder types are allowed (@see ./real-media-library.php for Constant-Types) 
     * @return boolean
     */
    wp_rml_is_type($folder, $allowed);

    Handle with RML_Folder objects

    Get childrens
    /**
     * Returns childrens of this folder.
     * 
     * @return array of RML_Folder
     */
    $rmlFolderObj->getChildrens();
    Fetch attachment IDs
    /**
     * Fetch all attachment ids currently in this folder.
     * 
     * @return array of post ids
     */
    $rmlFolderObj->fetchFileIds();
    Check if folder is a collection
    /**
     * Check if folder is a RML_TYPE_...
     * 
     * @param $folder_type (@see ./real-media-library.php for Constant-Types)
     * @return boolean
     */
    if ($rmlFolderObj->is(RML_TYPE_COLLECTION)) { [...] }
    Get slug and absolute path of folder
    $slug = $rmlFolderObj->slug();
    $path = $rmlFolderObj->absolutePath();