Help with enqueing scripts in footer after init action

If you enqueue the script to the footer while the page is being rendered (after the “wp_head” hook), you will have to manually add wp_print_scripts (or wp_print_footer_scripts) to the wp_footer action, like this:

wp_enqueue_script( 'jquery-gallery', null, array( 'jquery' ), null, true );
add_action( 'wp_footer', create_function( '', 'wp_print_scripts( "jquery-gallery" );' ) );