Howto use WP built in Thickbox for images?

What if you try adding this to your functions.php

function tb(){
    wp_enqueue_script('thickbox',null,array('jquery'));
    wp_enqueue_style('thickbox.css', "https://wordpress.stackexchange.com/".WPINC.'/js/thickbox/thickbox.css', null, '1.0');
}
add_action('wp_enqueue_scripts','tb');

and keeping your bit of jQuery (not sure what your are needing those php variables for):

 jQuery(document).ready(function() {
             jQuery("img").parent("a").addClass("thickbox");
         });