function html_img($url, $attributes = array(), $echo = true) { if (!ricUtil::is_url($url)) { return false; } if (!isset($attributes['alt'])) { $attributes['alt'] = ''; } // This attribute is required $gis = getimagesize($url); if ($gis) { $tag = 'img'; $attributes['src'] = $url; if (!(isset($attributes['width']) or isset($attributes['height']))) { list($attributes['width'], $attributes['height']) = $gis; } foreach ($attributes as $key => $value) { $tag .= ' ' . $key . '="' . esc_attr($value) . '"'; } $ret = "<{$tag}/>"; if ($echo) { echo $ret; } return $ret; } }