打印图像使用预定义的图像预设实用


Print an image using a predefined image preset pragmatically

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

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

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

我将非常感谢你的帮助。

使用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(),
    ),
));