Search code examples
phpdrupal-7block

How i can add relative path of image in Block Body Drupal7?


Previously my images were present in default/files folder ,i want to move them in theme specific images . priorly i accessed them via but i want to give relative path of themes images folder now in block body .

Can anyone please guide how it can be achieved . I assume my folder is not present at root level so <img src="/sites/all/themes/.." > will not work .


Solution

  • Refering to this answer you should use base_path() function and path_to_theme() :

    Example :

    <img src="<?php print base_path() . path_to_theme() .'/' ?>images/img.jpg" />