1

我只需要在 Drupal 7 中通过 php 打印出一张图像。我已经有 3 个预设,缩略图,中型和大型。有谁知道我需要打印出来的确切代码,因为我似乎无法解决?

据我所知,在 Drupal 6 中是这样的:

<img src="<?php print 'sites/default/files/imagecache/**thumbnail**/' . $node->field_image_cache['0']['filepath']; ?>" />

我将非常感谢任何帮助。

4

1 回答 1

2

使用theme_image_formatter

例如

print theme("image_formatter", array(
    'image_style' => 'thumbnail',
    'item' => array(
        'uri' => 'sites/default/files/image.jpg',
        'alt' => t(""),
        'title' => t(""),
        'attributes' => array(),
    ),
));
于 2013-01-17T07:34:11.977 回答