Get the Dimensions of the Theme Logo In Drupal 7 theme settings, you can upload a logo.
How do you print the width and height of this logo in your theme?



Background Research:

theme_get_setting('logo') lets you get the path of a logo uploaded in the theme settings.

image_get_info lets you get the height and width of an image.

However, image_get_info(theme_get_setting('logo')) does nothing.
You can use the following code. (Add error checking where necessary.)

  $image_url = parse_url(theme_get_setting('logo'));
  $image_path = str_replace(base_path(), realpath(DRUPAL_ROOT) . '/', $image_url['path']);
  $info = image_get_info($image_path);
  $height = $info['height'];
  $width = $info['width'];


As side note, theme_get_settings('logo_path') returns the path of the uploaded file used as logo. While theme_get_settings('logo') always return a value, whatever the logo is the default one, or one that has been uploaded, theme_get_settings('logo_path') returns a value when the logo has been uploaded.
The value returned for "logo_path" is similar to public://logo.png. To obtain the real path, you would use code similar to the following one.

  if ($image_uri = theme_get_settings('logo_path')) {
    if ($wrapper = file_stream_wrapper_get_instance_by_uri($image_uri)) {
      $image_path = $wrapper-&gt;realpath();
    }
    elseif (!empty($image_uri)) {
      $image_path = realpath($image_uri);
    }
  }