Joomla Asked on December 11, 2021
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?
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;
Answered by jamesgarrett on December 11, 2021
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:
https://yourdomain.com/images/yourimage.jpg
Answered by Grant G on December 11, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP