PHP getimagesize is not working when is called from a function in function.php (Wordpress)?

Posted by janoChen on Stack Overflow See other posts from Stack Overflow or by janoChen
Published on 2010-12-23T12:48:20Z Indexed on 2010/12/23 12:54 UTC
Read the original article Hit count: 225

Filed under:
|
|

PHP getimagesize is not working when is called from a function in function.php.

function.php:

add_action('wp_head', 'get_image_size');

function get_image_size() {

    global $width; // I thought this would solve the problem but it didn't
    global $height;  // I thought this would solve the problem but it didn't

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

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

$options['logo'] is returning http://localhost/wordpress/wp-content/uploads/2010/12/logo4.png so the image is being displayed.

I also did var_dump to $width and $height but they didn't show up.

Any suggestions?

© Stack Overflow or respective owner

Related posts about Wordpress

Related posts about function