I am building a Joomla 3.x module, I have used a media type field within the module params

<field name="image-1" type="media" label="Select your first image" directory="backgrounds" />

This is showing up within the XML file for the module, but how can I echo this (when it's completed) in the front end?

2 Answers 2


You access the parameter like you would any other parameter like so:


And to display the image, you can use the following:

<img src="<?php echo JUri::root() . $params->get('image'); ?>" alt="" />

You can see that I've used JUri::root() to define the root of your Joomla path.

  • You're welcome @RustyJoomla
    – Lodder
    Dec 2, 2014 at 10:07

This is how I do it:

  1. Set the position of your module to "whateveryouwant" (lets call it 'custommod01')

  2. Go to the article manager or wherever you'd like to see the module and write this into the text editor:

    {loadposition custommod01}

(If your using a plain HTML editor make sure you wrap it in <p> tags.)

Also if you wrap this code within a <div>, you can style the div and set attributes to this module dynamically per-page

  • 1
    You've explained how to display a moduel - the question was how to echo an image within the module :)
    – GDP
    Dec 2, 2014 at 15:45
  • Thanks for answering josh.thomson, but as @Lodder says this would load a module, not what was required but thanks for taking the time. Dec 2, 2014 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.