如何在drupal中的表单内渲染图像
How to render image inside a form in drupal
我尝试在表单内渲染图像,但仍然没有渲染任何东西
这是自定义模块
$image_options = array(
'path' => 'http://novelplanet.com/Content/images/noImage.jpg',
'alt' => 'Test alt',
'title' => 'Test title',
'width' => '50%',
'height' => '50%',
'attributes' => array('class' => 'image', 'id' => 'my-img'),
);
$image = theme('image', $image_options);
$form['y']['image_div'] = array(
'#prefix' => '<div class="image">',
'#suffix' => '</div>',
'#markup' => $image,
);
在我的 tpl
<?php print drupal_render($form['y']['image_div']); ?>
如何在 form.inc drupal 6
中渲染图像
使用主题方法如下:
theme('image', $path, $alt = '', $title = '', $attributes = NULL,
$getsize = TRUE);
你也可以使用
theme('imagecache', $presetname, $path, $alt = '', $title = '',
$attributes = NULL, $getsize = TRUE);
如果您使用 ImageCache 模块。
我尝试在表单内渲染图像,但仍然没有渲染任何东西
这是自定义模块
$image_options = array(
'path' => 'http://novelplanet.com/Content/images/noImage.jpg',
'alt' => 'Test alt',
'title' => 'Test title',
'width' => '50%',
'height' => '50%',
'attributes' => array('class' => 'image', 'id' => 'my-img'),
);
$image = theme('image', $image_options);
$form['y']['image_div'] = array(
'#prefix' => '<div class="image">',
'#suffix' => '</div>',
'#markup' => $image,
);
在我的 tpl
<?php print drupal_render($form['y']['image_div']); ?>
如何在 form.inc drupal 6
中渲染图像使用主题方法如下:
theme('image', $path, $alt = '', $title = '', $attributes = NULL,
$getsize = TRUE);
你也可以使用
theme('imagecache', $presetname, $path, $alt = '', $title = '',
$attributes = NULL, $getsize = TRUE);
如果您使用 ImageCache 模块。