You are here

function xbbcode_basic_render_img in Extensible BBCode 8

Same name and namespace in other branches
  1. 8.2 xbbcode_basic/xbbcode_basic.module \xbbcode_basic_render_img()
  2. 5 xbbcode_basic/xbbcode_basic.module \xbbcode_basic_render_img()
  3. 6 xbbcode_basic/xbbcode_basic.module \xbbcode_basic_render_img()
  4. 7 xbbcode_basic/xbbcode_basic.module \xbbcode_basic_render_img()
1 string reference to 'xbbcode_basic_render_img'
xbbcode_basic_xbbcode_info in xbbcode_basic/xbbcode_basic.module

File

xbbcode_basic/xbbcode_basic.module, line 198

Code

function xbbcode_basic_render_img($tag) {
  if ($tag->option) {
    list($width, $height) = explode('x', $tag->option);
  }
  elseif (isset($tag->args['width'], $tag->args['height'])) {
    list($width, $height) = array(
      $tag->args['width'],
      $tag->args['height'],
    );
  }
  else {
    list($width, $height) = array(
      0,
      0,
    );
  }
  $scale = $width && $height ? "style='width:{$width}px;height:{$height}px;'" : '';
  $alt = isset($tag->args['alt']) ? $tag->args['alt'] : "IMAGE({$tag->content})";
  return "<img {$scale} src='{$tag->content}' alt='{$alt}' />";
}