method
img
v2_2_9 -
Show latest stable
- Class:
CGI::HtmlExtension
img(src = "", alt = "", width = nil, height = nil)public
Generate an Image element as a string.
src is the URL of the image. alt is the alternative text for the image. width is the width of the image, and height is its height.
Alternatively, the attributes can be specified as a hash.
img("src", "alt", 100, 50) # <IMG SRC="src" ALT="alt" WIDTH="100" HEIGHT="50"> img("SRC" => "src", "ALT" => "alt", "WIDTH" => 100, "HEIGHT" => 50) # <IMG SRC="src" ALT="alt" WIDTH="100" HEIGHT="50">