Resolve exam images relative to Joomla root
This commit is contained in:
@@ -3,6 +3,17 @@
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
$resolveImageUrl = static function ($path) {
|
||||
$path = trim((string) $path);
|
||||
|
||||
if ($path === '' || preg_match('#^https?://#i', $path)) {
|
||||
return $path;
|
||||
}
|
||||
|
||||
return Uri::root() . ltrim($path, '/');
|
||||
};
|
||||
?>
|
||||
<div class="com-testquestions egzamin">
|
||||
<h1><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS'); ?></h1>
|
||||
@@ -43,7 +54,7 @@ use Joomla\CMS\HTML\HTMLHelper;
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($item->image) : ?>
|
||||
<div class="foto_pyt"><img src="<?php echo htmlspecialchars($item->image, ENT_QUOTES, 'UTF-8'); ?>" alt="" loading="lazy"></div>
|
||||
<div class="foto_pyt"><img src="<?php echo htmlspecialchars($resolveImageUrl($item->image), ENT_QUOTES, 'UTF-8'); ?>" alt="" loading="lazy"></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($item->question_type === 'open') : ?>
|
||||
<div class="<?php echo $this->results ? ($this->results['items'][$item->id]['correct'] ? 'odpup' : 'odpu') : 'odp'; ?>">
|
||||
|
||||
Reference in New Issue
Block a user