PHP getimagesize isn't working just when was known as from the function in function.php.



    // Theme Options
    require_once(TEMPLATEPATH . '/functions/admin-menu.php');

    add_action('wp_head', 'theme_options', 'get_image_size');

    function theme_options() {
        // Initiate Theme Options
        $options = get_option('plugin_options');

        // If a logo image was uploaded then remove text from site title
        if ($options['logo'] != NULL)
            $remove_text = '-9999px';

            $remove_text = 0;

        body {
            background-color: <?php echo $options['color_scheme']; ?>

        #header h1 a {
            background: url(<?php echo $options['logo']; ?>) no-repeat scroll 0 0;
            text-indent: <?php echo $remove_text; ?>;

    function get_image_size() {

        list($width, $height, $type, $attr) = getimagesize($options['logo']);

        echo "Image width " .$width;
        echo "<BR>";
        echo "Image height " .$height;
        echo "<BR>";


$options['logo'] is coming back http://localhost/wordpress/wp-content/uploads/2010/12/logo4.png therefore the image has been displayed.

I additionally did var_dump to $width and $height however they did not appear.

Any suggestions?

EDIT: I copied and pasted the entire code of functions.php. $options['logo'] works perfectly within the theme_option function so I'm not sure why it does not operate in the get_image_size function.

$options['logo'] is undefined inside your code. If it's defined outdoors of the function, it's not automatically available inside your function.

Please enable error confirming using ini_set('display_errors', 1) and error_reporting(E_ALL), when developing. This can make certain any errors are reported.

I you don't use whatever error messages, arrive error_reporting and display_errors.

$options['logo'] works perfectly in the theme_option function and so i don't know why it does not operate in the get_image_size function.

As @Sjoerd stated: $options isn't defined in function get_image_size. It is simply defined in function theme_options. That is what functions are about, they're a black box that learn about their atmosphere only in the arguments they receive. If you wish to result in the options visible in function get_image_size, you need to Initiate Theme Options for the reason that work as well.

I discovered how you can repair it (separating the functions into different add_action claims):

add_action('wp_head', 'theme_options');

function theme_options { 

add_action('wp_head', 'get_image_size');

function get_image_size { 

The add_action only enables one function?

That which was the issue?