drupal image path

2019-06-14 10:22发布

i created a page content type, and put this code in it. and set the input style to php.why the image can't show. i test it on my localhost.

       <img src="<?php echo $bath_path; ?>/images/1.jpg">

1条回答
孤傲高冷的网名
2楼-- · 2019-06-14 10:56

Drupal way:

$path2file = base_path().'/images/1.jpg'; // If image located in {drupal root}/images. If image located in files directory, use file_directory_path() to get this path
print theme('image', $path_to_file, t('Image altername name'), t('Image title'));
查看更多
登录 后发表回答