aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-html-image.md
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-html-image.md')
-rw-r--r--vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-html-image.md54
1 files changed, 28 insertions, 26 deletions
diff --git a/vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-html-image.md b/vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-html-image.md
index e21f2a121..7ecde2654 100644
--- a/vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-html-image.md
+++ b/vendor/smarty/smarty/docs/designers/language-custom-functions/language-function-html-image.md
@@ -1,25 +1,26 @@
-{html\_image} {#language.function.html.image}
-=============
+# {html_image}
-`{html_image}` is a [custom function](#language.custom.functions) that
+`{html_image}` is a [custom function](index.md) that
generates an HTML `<img>` tag. The `height` and `width` are
automatically calculated from the image file if they are not supplied.
- 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
- path\_prefix string no *n/a* Prefix for output path
+## Attributes
+
+| Attribute Name | Required | Description |
+|----------------|----------|-------------------------------------------------------------------------|
+| file | Yes | name/path to image |
+| height | No | Height to display image (defaults to actual image height) |
+| width | No | Width to display image (defaults to actual image width) |
+| basedir | no | Directory to base relative paths from (defaults to web server doc root) |
+| alt | no | Alternative description of the image |
+| href | no | href value to link the image to |
+| path\_prefix | no | Prefix for output path |
- `basedir` is the base directory that relative image paths are based
- from. If not given, the web server\'s document root
+ from. If not given, the web server's document root
`$_ENV['DOCUMENT_ROOT']` is used as the base. If security is
enabled, then the image must be located in the `$secure_dir` path of
- the security policy. See the [Security](#advanced.features.security)
+ the security policy. See the [Security](../../programmers/advanced-features/advanced-features-security.md)
section for details.
- `href` is the href value to link the image to. If link is supplied,
@@ -35,22 +36,23 @@ automatically calculated from the image file if they are not supplied.
> **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](#caching), it is generally better to avoid `{html_image}`
+> calculate the height and width. If you don't use template
+> [caching](../../programmers/caching.md), it is generally better to avoid `{html_image}`
> and leave image tags static for optimal performance.
+## Examples
- {html_image file='pumpkin.jpg'}
- {html_image file='/path/from/docroot/pumpkin.jpg'}
- {html_image file='../path/relative/to/currdir/pumpkin.jpg'}
-
-
+```smarty
+{html_image file='pumpkin.jpg'}
+{html_image file='/path/from/docroot/pumpkin.jpg'}
+{html_image file='../path/relative/to/currdir/pumpkin.jpg'}
+```
Example output of the above template would be:
-
- <img src="pumpkin.jpg" alt="" width="44" height="68" />
- <img src="/path/from/docroot/pumpkin.jpg" alt="" width="44" height="68" />
- <img src="../path/relative/to/currdir/pumpkin.jpg" alt="" width="44" height="68" />
-
+```html
+<img src="pumpkin.jpg" alt="" width="44" height="68" />
+<img src="/path/from/docroot/pumpkin.jpg" alt="" width="44" height="68" />
+<img src="../path/relative/to/currdir/pumpkin.jpg" alt="" width="44" height="68" />
+```