| Attribute Name | Type | Required | Default | Description |
|---|---|---|---|---|
| file | string | Yes | n/a | name/path to image |
| height | string | No | actual image height | height to display image |
| width | string | No | actual image width | width to display image |
| basedir | string | no | web server doc root | directory to base relative paths from |
| alt | string | no | "" | alternative description of the image |
| href | string | no | n/a | href value to link the image to |
html_image is a custom function that generates an HTML tag for an image. The height and width are automatically calculated from the image file if none are supplied.
html_image 是一個客制化函式,可以產生讓影像使用的 HTML 標籤,如果沒 有提供影像的 height 與 width 的話,則會自動根據所提供的影像檔案資料而得。
basedir is the base directory that relative image paths are based from. If not given, the web server document root (env variable DOCUMENT_ROOT) is used as the base. If security is enabled, the path to the image must be within a secure directory.
basedir 指的是相關影像檔的目錄路徑。如果沒有設定的話,則會使用網頁伺 服器的根目錄(env 變數 DOCUMENT_ROOT)。如果有開啟安全機制的話,則影像的目錄路徑也必 須是一個安全路徑。
href is the href value to link the image to. If link is supplied, an <a href="LINKVALUE"><a> tag is put around the image tag.
href 是影像會連結到的 href 值,如果沒有給定的話,則會使用 <a href="LINKVALUE"><a>。
All parameters that are not in the list above are printed as name/value-pairs inside the created <img>-tag.
所有在上面所列出的參數並不是每個都可以以 name/value 的方式在 <img> 標籤中列印出來的。
Technical Note: html_image requires a hit to the disk to read the image and calculate the height and width. If you don't use template caching, it is generally better to avoid html_image and leave image tags static for optimal performance.
技術提醒: html_image 需要從硬碟中讀取影像檔且計算影像檔的長與寬,如果你沒有使 用樣版快取的話,最好是避免使用 html_image 而是使用 image 靜態標籤以取得更好的效能。