Correct image path to use in template files of custom themes I'm creating a custom theme. Under my theme's folder, there is an images folder where I've put some pictures. I want to use these images in my various template (.tpl.php) files using HTML &lt;img&gt; tag... but the problem is how do i get correct path for these images (the src attribute)?

I've searched for a while but didn't get any solutions. Please help.

EDIT: I'm using nice urls (http://mydrupalsite.com/a/b/c/d) - type URLs. So, if the image src begins with / (or any relative path) it would break.
I think these functions could be useful in your templates:

print base_path() . path_to_theme();


path_to_theme() Return the path to the current themed element.
base_path() The base path of the Drupal installation.

for example, I have an image called bg-bar.png inside images directory in my template directory called garland. then I can use base_path() and path_to_theme() to get the path to the image, for example inside node.tpl.php:

print '&lt;img src="'.base_path() . path_to_theme() .'/images/bg-bar.png"&gt;';


Update: if you want to use the current domain, you can use global $base_root:

  $address = ''.base_path() . path_to_theme() .'/images/bg-bar.png';
  global $base_root;
  echo '&lt;img src="' . $base_root . $address . '"&gt;';


I hope information be useful.