{jrCore_image}

  • The {jrCore_image} function is a widely used template function used to manipulate images.

    Jamroom modules and skins both have an image tab in their ACP control section that allows the admin user to override default images.

    By using the {jrCore_image} template function to retrieve images from your module or skin you allow the admin to override them via that system.
  • The /img directory

    When you build your module or skin, put all the images into the /img directory to make them accessible to the {jrCore_image} system.

    So for example, the Audio module has an /img directory found at:
    /modules/jrAudio/img

    and the elastic skin has an image directory found at:
    /skins/jrElastic/img

    Because those locations are used, the images show up in the IMAGES tab of the audio module in the ACP and the IMAGES tab of the skin in the ACP and are accessible via the {jrCore_image} function in templates.
  • {jrCore_image}

    Function
    {jrCore_image}
    parameter
    type
    default
    required
    description
    module
    string
    -
    off
    The name of the module whos /img directory you want. If not provided the active skin will be assumed.
    image
    string
    -
    on
    the name of the file in the relative directory
    width
    int
    -
    off
    the width="" element on the returned html
    height
    int
    -
    off
    the height="" element on the returned html
    alt
    string
    -
    off
    the alt="" element on the returned html
    src_only
    bool
    -
    if set to TRUE it will return just the url of the image, no HTML
    title
    string
    -
    the title="" element on the returned html
    class
    -
    the class="" element on the returned html
    style
    -
    the style="" element on the returned html
    onclick
    -
    the onclick="" element on the returned html
    To use the function in a template just pass in the parameters to retrieve the HTML element.
  • Examples

    get the spinner.gif file from the embed modules /img folder
    /modules/jrEmbed/img/spinner.gif
    {jrCore_image module="jrEmbed" image="spinner.gif" width="24" height="24" alt="working...."}
  • That will return
    <img src="http://your-site.com/image/img/module/jrEmbed/spinner.png" height=24 width=24 alt="working...">
  • Note that the URL returned is not the hard-coded filesystem url of the location of the image, but rather the url of the image modules image function to determine which image is the correct one to use.

    If the admin user decides to override that image the template url will not need to be changed to get the fresh image working.

Tags