Php Drupal7制作图像链接。不会显示图像吗?

Php Drupal7制作图像链接。不会显示图像吗?,php,drupal-7,Php,Drupal 7,我正在尝试制作一个图像链接,但我的图像文件无法显示。有人能帮忙吗?谢谢 这是我的密码 function linking_module_basic(){ $content = array(); $variables = array( 'path' => 'sites\all\modules\tshirt.png', 'alt' => t('Click to create new shirt'), 'title' => t('Create

我正在尝试制作一个图像链接,但我的图像文件无法显示。有人能帮忙吗?谢谢

这是我的密码

function linking_module_basic(){
    $content = array();

    $variables = array(
    'path' => 'sites\all\modules\tshirt.png',
    'alt' => t('Click to create new shirt'),
    'title' => t('Create shirt'),
    );

    $content['themed_data'] = array(
        '#type' => 'markup',
        '#markup' => theme('image', $variables),
        '#prefix' => '<div class = "linking-module-image"><a href = "https://www.facebook.com/">',
        '#suffix' => '</div></a>',
        '#attached' => array(
            'css' => array(
                drupal_get_path('module', 'linking_module') . '/linking_module.css',
            ),
        ),
    );

    return $content;
}

我好像弄不明白。

这是你的问题!!。Drupal正在编码图像路径

在图像的
路径
值上,将反斜杠更改为正斜杠,并添加基本路径

function linking_module_basic(){
    $content = array();

    $variables = array(
    'path' => base_path() . 'sites/all/modules/tshirt.png',
    'alt' => t('Click to create new shirt'),
    'title' => t('Create shirt'),
    );

    $content['themed_data'] = array(
        '#type' => 'markup',
        '#markup' => theme('image', $variables),
        '#prefix' => '<div class = "linking-module-image"><a href = "https://www.facebook.com/">',
        '#suffix' => '</div></a>',
        '#attached' => array(
            'css' => array(
                drupal_get_path('module', 'linking_module') . '/linking_module.css',
            ),
        ),
    );

    return $content;
}
函数链接\u模块\u基本(){
$content=array();
$variables=数组(
'path'=>base_path()'sites/all/modules/tshirt.png',
'alt'=>t('单击以创建新衬衫'),
'title'=>t('Create shirt'),
);
$content['themed_data']=数组(
“#键入”=>“标记”,
“#markup”=>主题('image',$variables),
“#前缀”=>”,
“#已连接”=>数组(
'css'=>数组(
drupal_get_path('module','linking_module')。/linking_module.css',
),
),
);
返回$content;
}

只要图像在指定的路径中,它现在就可以工作

你如何调用函数“linking_module_basic”以及在哪里调用@prabeengiri我已经编辑了我的帖子。。。希望你能帮助tnx!
function linking_module_basic(){
    $content = array();

    $variables = array(
    'path' => base_path() . 'sites/all/modules/tshirt.png',
    'alt' => t('Click to create new shirt'),
    'title' => t('Create shirt'),
    );

    $content['themed_data'] = array(
        '#type' => 'markup',
        '#markup' => theme('image', $variables),
        '#prefix' => '<div class = "linking-module-image"><a href = "https://www.facebook.com/">',
        '#suffix' => '</div></a>',
        '#attached' => array(
            'css' => array(
                drupal_get_path('module', 'linking_module') . '/linking_module.css',
            ),
        ),
    );

    return $content;
}