Hi,
I'm doing a content override.
I need to use the intro image in the masthead.
In the override there is this code:

<?php
/**
T4 Overide
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Associations;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
//use Joomla\Component\Content\Administrator\Extension\ContentComponent;
use T4\Helper\J3J4;

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');

// Create shortcuts to some parameters.
$params  = $this->item->params;
$images  = json_decode($this->item->images);
$urls    = json_decode($this->item->urls);
$canEdit = $params->get('access-edit');
$user    = Factory::getUser();
$info    = $params->get('info_block_position', 0);

$document = JFactory::getDocument();
$imageBg = $images->image_intro;
$templateSettings = JFactory::getApplication()->getTemplate(true)->params;

// Check if associations are implemented. If they are, define the parameter.
$assocParam = (Associations::isEnabled() && $params->get('show_associations'));

$jcFields = \Joomla\Utilities\ArrayHelper::pivot($this->item->jcfields , 'name');

// put heading to masthead
if ($document->countModules('masthead') || !$this->print || $tmpl !== 'component') {

	$masthead = JLayoutHelper::render('joomla.content.masthead', array('params' => $this->params, 'title' => $this->escape($this->item->title), 'item' => $this->item, 'print' => $this->print, 'templateSettings' => $templateSettings, 'params' => $params, 'imageBg' => $imageBg));

	$document->setBuffer($masthead, array('type' => 'modules', 'name' => 'masthead', 'title' => ''));
}

?>

But the image doesn't appear, the masthead use the default image

    Hi razzo1

    May I know which template are you using?

    You can share the credentials of your site eg: URL + super admin account and tell me the file that you override.

    I will check for you.

    3 years later

    Hi,

    I have the same problem/code with JA Stark override: html/com_content/article/project.php ;
    param imageBG does not override the default background which is somehow set in: media/t4/css/13-sub.css

    I would like to know the solution to this and where this sub css comes from.

    Thanks

      5 days later

      marty-harty Hi

      Could you share the credentials of your site eg: URL + super admin account so I can take a look at your setting and see if its possible to achieve that?

      And share the URL of that page as well.

      Hi guys,

      Let me take JA Stark template as sample. You will need to update 2 files:

      /templates/ja_stark/html/layouts/joomla/content/masthead.php
      /templates/ja_stark/html/com_content/article/project.php

      mastheadphp.zip
      979B
      projectphp.zip
      3kB

      Note that if you want to set fulltext image as background image of masthead section, you open the file: /templates/ja_stark/html/com_content/article/project.php

      Look for this line of code:

      $imagesBg = $images->image_intro;

      change it to:

      $imagesBg = $images->image_fulltext;
      Write a Reply...
      You need to Login to view replies.