I use the Fields component and I have a field "Media". You can choose an image this way. But this spits out a full tag. This should be no problem but in my case I need it to be a full absolute url instead of relative. Does someone know how to achieve this or should I just use a regex to change the url myself?

  • 1. Fields can either be used via the automatic display or used manually in a template override. Which one are you talking about? 2. Why do you want your img's src attribute to have a domain in it? Jul 24, 2020 at 0:10
  • 1. The problem is that when I use the media field it generates an <img src=..... tag.. 2. I want to output HTML and use that in another way
    – Kuubs
    Jul 27, 2020 at 12:37

2 Answers 2


I think you are looking for the rawvalue property of the field object

/* Rearrange Fields for use */
foreach($this->item->jcfields as $jcfield){
    $this->item->jcFields[$jcfield->name] = $jcfield;

$absolute_path_to_image = JUri::base() . $this->item->jcFields['your-field-name']->rawvalue;

You would need to override the core functionality. Or simply, in your template(s) where you output your images, you could just use:

<?php echo JUri::base() . $yourimagevariable;?>

Which will generate:

  • Where can I find htis? I now use a regex...
    – Kuubs
    Jul 27, 2020 at 12:36
  • @HuubS that entirely depends where and how you are using the image in your templates, if that is what you are doing. If you set your Field to Automatic Display: Do not automatically display then you can access it in your template instead, to produce the desired effect as per above. In an article layout, you would access the raw image path from the $this->item->jcfields object.
    – Grant G
    Jul 27, 2020 at 13:07
  • The problem is that the media field automatically generates a full <img tag.. it's not only spitting out the url only.. I don't use automatic display, I always get the fields like this: $this->item->jcfields
    – Kuubs
    Jul 27, 2020 at 14:27

Your Answer

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

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