See the image displayed, along with the rest of the contact information entered and set to display.
Contact information displays on the public facing website but the image is broken. (Image displays as a thumbnail in the data entry screen.)
Rendered HTML shows an incorrect path to the image:
PHP 7.4.11
Database version 5.7.32
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
Hi, @jen4web which formalt is your image? jpg, JPEG, png, PNG ... I cannot see that in your screen.
Hi chmst - I tested .jpg, .png
The path to the image in the code was img src="/joomla/" alt="Leaf and Mortar"
However - it seems the issue is related to the file name. If there are spaces in the file name, i.e. "leaf image.png", this produces a broken image. If there are no spaces in the file name, then the image is fine.
Spaces in the file name does not seem to be an issue elsewhere, as I've used these images in the media manager in articles and modules elsewhere on the site.
Confirm the issue with space in filename. The reason is because:
is_file
check https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/HTML/HTMLHelper.php#L1316 return false, and no image is returnedA possible solution is replace %20 back to space on is_file check. So the code would be something like:
private static function checkFileOrder($first, $second)
{
$decodedSecond = str_replace('%20', ' ', $second);
if (is_file($decodedSecond))
{
return static::convertToRelativePath($second);
}
$decodedFirst = str_replace('%20', ' ', $first);
if (is_file($decodedSecond))
{
return static::convertToRelativePath($first);
}
return '';
}
That works. But is it a good solution?
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-10-30 10:51:46 |
Closed_By | ⇒ | joomdonation |
HTML for the contact image:
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35940.