Allow author to upload image via Media button without plugin

in the basic configuration the user role contributor and subscriber do not have the capability upload_files. The user role author has this capability.

The capability upload_files gives the user the panels “Media” and “Media > Add New”.

If you want another role to grant this capability, you can use the function add_cap(). Since such changes are written into the database, it makes sense to use this function at the moment your plugin gets activated in order not to write to the database with every page load (since you could also use this funtion in lets say the init hook). So you should also have a look into register_activation_hook(). Assuming, you place this code into the “root” file of your plugin this should work:

<?php
    function wpse210884_add_upload_files_cap() {
        $role = get_role( 'contributor' ); //The role you want to grant the capability
        $role->add_cap( 'upload_files' );
    }

    register_activation_hook( __FILE__, 'wpse210884_add_upload_files_cap' );
?>