How to get drupal logo path? Where is it stored in DB?

Comments

Cayenne’s picture

Select "view image", and then you'll see the path.

The exact location of the logo is set by your theme, so it may vary a bit from theme to theme, but it's generally in the theme folder.

Firebug is your friend, and will let you trace this and many other issues.

:)

yelvington’s picture

Do not poke around in the database for such information. Use the documented API.

The template system makes $logo available to page.tpl.php.

http://api.drupal.org/api/drupal/modules--system--page.tpl.php

http://api.drupal.org/api/function/template_preprocess_page/6

http://api.drupal.org/api/function/theme_get_setting/6

lipinponmala007’s picture

    global $theme_key;
    global $base_url;
    $themes = list_themes();
    $theme_object = $themes[$theme_key];
    $settings = theme_get_settings($theme_key);
    $logos = $base_url .'/'. $settings['logo_path']; //this is the logo path

l

kingandy’s picture

print theme_get_setting('logo');

That function does all the theme identifying and data fetching stuff for you and returns the key required (in the example above, it's the equivalent of skipping everything out and jumping right to the $settings['logo_path'] step).

If you really want you can use theme_get_setting('logo_path'), but that'll get you the manually-set logo path regardless of whether the theme is set to use it - if the theme is configured to use logo_default you're boned. 'logo' will return whichever of those paths the theme is currently using.

++Andy
Developing Drupal websites for Livelink New Media since 2008

hkirsman’s picture

This worked for me. Tx! And you might need to set the theme in second parameter

print theme_get_setting('logo', 'YOUR-THEME-NAME'); 
arunkumark’s picture

Hi,
This code works well, pls try,

global $theme_key;
$logo_url = theme_get_setting('logo_path', $theme_key);
print $logo_url;

kingandy’s picture

You don't need to declare or pass in your global $theme_key - if no second parameter is provided, the theme_get_setting() function assumes it's the current theme.

++Andy
Developing Drupal websites for Livelink New Media since 2008

makbul_khan8’s picture

This will help to get & set logo of your theme.

$theme_name = 'Garland';  
$var_name = 'theme_' . $theme_name . '_settings';
$settings = variable_get($var_name, array());
$settings['logo_path'] = $new_path;
variable_set($var_name, $settings);