• hookedonweb

    (@hookedonweb)


    I am trying to get a phantom image to work with the built in Thickbox functionality.

    To get the Admin Thickbox to work in the theme I did this:

    I added this code the my functions.php file

    function add_themescript(){
        if(!is_admin()){
        wp_enqueue_script('jquery');
        wp_enqueue_script('thickbox',null,array('jquery'));
        wp_enqueue_style('thickbox.css', '/'.WPINC.'/js/thickbox/thickbox.css', null, '1.0');
        }
    
    }
    add_action('init','add_themescript');

    I also added this to the footer.php file:

    <script type="text/javascript">
    if ( typeof tb_pathToImage != 'string' )
    {
        var tb_pathToImage = "<?php echo get_bloginfo('url').'/wp-includes/js/thickbox'; ?>/loadingAnimation.gif";
    }
    if ( typeof tb_closeImage != 'string' )
    {
        var tb_closeImage = "<?php echo get_bloginfo('url').'/wp-includes/js/thickbox'; ?>/tb-close.png";
    }
    </script>

    It seems to work just fine.

    Now the interesting part…

    I created a QR code with the Google Charts API. The following will produce the QR via the Google Charts API just fine:

    [Link moderated]

    Click on the link above to see the results.

    What happens is that a QR Code image is displayed but its not a physical image. If you right click you can have the image as a working .png file.

    When I setup a normal anchor with a Thickbox call is works fine.

    The problem is when I use the HTML link from Google Charts in the href attribute, the overlay comes on and the Thickbox display but it is empty and the title and close button never displays.

    If I take the same anchor tag and put a filename.png in the href it works.

    If a make use the HTML link from Google Charts and put it into the ref and img section of an anchor link is works just fine.

    The problem is getting Thickbox to see the html link as a physical file.

  • The topic ‘Thickbox advanced hack (this one is a challenge)’ is closed to new replies.