Drupal 7制作图像链接.不会显示图像


Drupal 7 making image link. wont show image?

我试图使一个图像链接,但我的图像文件不会显示谁可以帮助?由于

这是我的代码

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;
}

我的hook_menu

      function linking_module_menu() {
        $items = array();
        $items['linking'] = array(
        'title' => 'A Linking module',
        'page callback'  => 'linking_module_basic',
        'access arguments' => array('access content'),

    );
    return $items;
  }

我似乎想不明白。

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

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

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;
}

现在应该可以工作了,只要你在指定的路径中有图像!!