No Code Attached Yet
avatar jen4web
jen4web
29 Oct 2021

Steps to reproduce the issue

  1. Create a new contact: Components - Contacts - New
  2. Choose or upload an image in the "image" field in "Edit Contact"
  3. Enter other contact information as desired.
  4. Save contact.
  5. Link to menu.
  6. Look at the contact screen on the front end.

Expected result

See the image displayed, along with the rest of the contact information entered and set to display.

Actual result

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:

Leaf and Mortar

System information (as much as possible)

PHP 7.4.11
Database version 5.7.32

Additional comments

screen shot 2021-10-29 at 21 47 34
screen shot 2021-10-29 at 21 47 34

avatar jen4web jen4web - open - 29 Oct 2021
avatar jen4web jen4web - change - 29 Oct 2021
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 29 Oct 2021
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 29 Oct 2021
avatar jen4web jen4web - change - 29 Oct 2021
The description was changed
avatar jen4web jen4web - edited - 29 Oct 2021
avatar jen4web
jen4web - comment - 29 Oct 2021

HTML for the contact image:

    
Leaf and Mortar

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35940.
avatar brianteeman
brianteeman - comment - 29 Oct 2021

Can not replicate

image

image

avatar chmst
chmst - comment - 29 Oct 2021

Hi, @jen4web which formalt is your image? jpg, JPEG, png, PNG ... I cannot see that in your screen.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35940.

avatar jen4web
jen4web - comment - 29 Oct 2021

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.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35940.

avatar joomdonation
joomdonation - comment - 30 Oct 2021

Confirm the issue with space in filename. The reason is because:

A 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?

avatar joomdonation joomdonation - close - 30 Oct 2021
avatar joomdonation
joomdonation - comment - 30 Oct 2021

Please test PR #35948 . Thanks !

avatar joomdonation joomdonation - change - 30 Oct 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-10-30 10:51:46
Closed_By joomdonation

Add a Comment

Login with GitHub to post a comment