MEDIA-JOOMLAIMAGE-001
images/lms/hero.jpg (raw path)
Media field #joomlaImage:// paths
Joomla 4 media fields store #joomlaImage://local-0/images/foo.jpg?width=… not a plain path. Echoing the raw value breaks <img>.
images/lms/hero.jpg (raw path) → HTMLHelper::cleanImageURL() / MediaHelper::getCleanMediaFieldValue()
Symptoms people search
broken images after Joomla 4 · joomlaImage in src · media field
Replace this code
Swap images/lms/hero.jpg (raw path) for HTMLHelper::cleanImageURL() / MediaHelper::getCleanMediaFieldValue().
Joomla 3
Remove or stop calling this
echo '<img src="' . $this->item->image . '">';Joomla 4 / 6
Use this instead
$img = HTMLHelper::cleanImageURL($this->item->image);
echo '<img src="' . htmlspecialchars($img->url) . '">';How to fix it
- 1Run cleanImageURL before output.
- 2Or MediaHelper::getCleanMediaFieldValue().
Also known as
#joomlaImage · cleanImageURL · media field
Related issues
- Joomla 3 → 4Joomla API
JRequest::getVar() and the whole JRequest API
JRequest::getVar() → $app->getInput()->get('id')
- Joomla 3 → 4Joomla API
JError / JException
JError::raiseError() → throw new RuntimeException() / try-catch
- Joomla 3 → 4Joomla API
isAdmin() / isSite()
$app->isAdmin() → $app->isClient('administrator') / isClient('site')
- Joomla 3 → 4Joomla API
Factory::getUri()
JFactory::getUri() → Uri::getInstance()
- Joomla 3 → 4Joomla API
Factory::getXml() / JXMLElement
JFactory::getXML() → SimpleXMLElement
- Joomla 3 → 4Joomla API
Factory::getEditor()
JFactory::getEditor() → Editor::getInstance()