[英]How to render image inside a form in drupal
I've try to render an image inside the form but still doesnt render anything 我尝试在表单内渲染图像,但仍然不渲染任何内容
Here's custom module 这是自定义模块
$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,
);
in my tpl 在我的tpl中
<?php print drupal_render($form['y']['image_div']); ?>
How do I render image inside the form.inc drupal 6 我如何在form.inc drupal 6内部渲染图像
Use the theme method as follows: 使用主题方法,如下所示:
theme('image', $path, $alt = '', $title = '', $attributes = NULL,
$getsize = TRUE);
you can also use 你也可以使用
theme('imagecache', $presetname, $path, $alt = '', $title = '',
$attributes = NULL, $getsize = TRUE);
if you use the ImageCache module. 如果使用ImageCache模块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.