img

File-related functions

Summary

img() is a helper function used to include an image from within a theme. It returns the URL to an image file located in the images directory of that theme, usually located in themes/YourTheme/images. The resulting path can be used in an <img> tag, or anywhere else an image URL is needed.

img(string $file, string $dir = images)

Return the web path to an image file.

Parameters:
  • $file (string) – Filename, including the extension.
  • $dir (string) – Directory within the theme to look for image files. Defaults to ‘images’.
Returns:

string

Usage

Examples

See Also

Project Versions

Table Of Contents

Previous topic

files_for_item

Next topic

item_image

This Page