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

Getting Category’s custom fields in a blog view

1  Asked on September 5, 2021 by semaphore

   

How to post checkout data to component using Ajax?

1  Asked on September 5, 2021 by askerman

   

Display specific Joomla user groups

1  Asked on September 5, 2021 by niaziblog

   

how to get value for search in joomla module

1  Asked on September 5, 2021 by rhea-lorraine

   

Joomla installation on localhost using WAMP does not start

1  Asked on September 5, 2021 by bilal-kabeer-butt

 

Jquery script loaded on every page

1  Asked on September 5, 2021 by gag

   

category links don’t work

1  Asked on September 5, 2021 by giovanni-de-maria

         

Joomla 3.9 Child Sub Menu Not Showing

1  Asked on September 5, 2021 by ta1982

         

Trying to connect to an external ODBC data source

1  Asked on September 5, 2021 by irata

   

Can’t get a task to work from CLI

0  Asked on September 5, 2021 by tc0072

 

Ask a Question

Get help from others!

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