AnswerBun.com

Fields component media field using absolute url instead of relative

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?

2 Answers

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

Add your own answers!

Related Questions

Add field to menu settings to output open graph image

1  Asked on December 30, 2021 by mano-meter

   

Edited css not updated in XAMPP

1  Asked on December 9, 2021 by advait-varma

     

Update from 3.9.x to 4.x

2  Asked on November 27, 2021 by lovntola

       

Other files overriding my template css with bootstrap?

1  Asked on November 19, 2021 by matthiasdunkel

   

Javascript accordion with anchors for joomla

1  Asked on November 5, 2021 by fruit_alchemist

   

Cannot Connect To MSSQL Server

3  Asked on September 5, 2021 by jamesmandatory

       

PlotALOT RSForm Query showing only one result

1  Asked on September 5, 2021 by gart

       

Getting module parameters in AJAX call using module id

1  Asked on September 5, 2021 by user1616338

     

Pop up AcyMailing subscription form

1  Asked on September 5, 2021 by ygiorgos

       

Override 3d party extension plugin method

0  Asked on September 5, 2021 by dmitry-zar

 

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP