src/thinkextend/parser/driver/Ubb.php
private function _imgWidthAndHeight($name, $data)
    {
        if (empty($data[2]) && empty($data[3])) {
            $data = "<img src=\"{$data[4]}\" />";
        } elseif (!empty($data[2]) && empty($data[3])) {
            $data = "<img width=\"{$data[2]}\" src=\"{$data[4]}\" />";
        } elseif (empty($data[2]) && !empty($data[3])) {
            $data = "<img height=\"{$data[3]}\" src=\"{$data[4]}\" />";
        } else {
            $data = "<img width=\"{$data[2]}\" height=\"{$data[3]}\" src=\"{$data[4]}\" />";
        }
        return $data;
    }
private function _imgWidthAndHeight($name, $data)
    {
        if (empty($data[2]) && empty($data[3])) {
            $data = "<img src=\"{$data[4]}\" />";
        } elseif (!empty($data[2]) && empty($data[3])) {
            $data = "<img width=\"{$data[2]}\" src=\"{$data[4]}\" />";
        } elseif (empty($data[2]) && !empty($data[3])) {
            $data = "<img height=\"{$data[3]}\" src=\"{$data[4]}\" />";
        } else {
            $data = "<img width=\"{$data[2]}\" height=\"{$data[3]}\" src=\"{$data[4]}\" />";
        }
        return $data;
    }
private function _imgWidthAndHeight ( $ name , $ data ) { if ( empty ( $ data [ 2 ] ) && empty ( $ data [ 3 ] ) ) { $ data = "<img src=\"{$data[4]}\" />" ; } elseif ( ! empty ( $ data [ 2 ] ) && empty ( $ data [ 3 ] ) ) { $ data = "<img width=\"{$data[2]}\" src=\"{$data[4]}\" />" ; } elseif ( empty ( $ data [ 2 ] ) && ! empty ( $ data [ 3 ] ) ) { $ data = "<img height=\"{$data[3]}\" src=\"{$data[4]}\" />" ; } else { $ data = "<img width=\"{$data[2]}\" height=\"{$data[3]}\" src=\"{$data[4]}\" />" ; } return $ data ; }
解析含有width和height属性的图片标签
@param  string $name 标签名
@param  array  $data 解析数据 [2] - width, [3] - height, [4] - 图片URL
@return string       解析后的标签
解析含有width和height属性的图片标签