No Code Attached Yet
avatar Scrabble96
Scrabble96
11 Feb 2023

Back in February 2022 I reported "Custom media field images and images in Images and Links tab do not display height, width, loading" in issue #37006. This was apparently fixed and merged with PR 37008 "[4.1][bugfix] Use the one true way to render images: with jLayout #37008" on 22 Feb 2022.

I say 'apparently', but something seems to have happened to revert the code.

After much testing, and wondering if it was a J3-to-J4 upgrade issue, I had a look at the database for a site I've been working on over the same period. Images in articles I last updated on 31st October 2022 have their height, width and loading attributes, but in an article created mid-October, but which had an image added later and was last modified on 5th December 2022, does not have any attributes stored.

Steps to reproduce the issue

Add an image to an article via "Images and Links" tab or via a custom field of type 'media'.
View the resulting article on the front end and inspect with your browser's developer tools.

Expected result

To see height, width and loading="lazy"

Actual result

None of these

System information (as much as possible)

Additional comments

avatar Scrabble96 Scrabble96 - open - 11 Feb 2023
avatar joomla-cms-bot joomla-cms-bot - change - 11 Feb 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 11 Feb 2023
avatar Scrabble96 Scrabble96 - change - 11 Feb 2023
The description was changed
avatar Scrabble96 Scrabble96 - edited - 11 Feb 2023
avatar Quy
Quy - comment - 14 Feb 2023

Not reproducible on my end. Do you have this issue on a clean install?

avatar alikon
alikon - comment - 15 Feb 2023

unable to reproduce too

avatar Scrabble96
Scrabble96 - comment - 15 Feb 2023

Brand new installations work fine, but...

I have this issue on:
An older installation of Cassiopeia (from 4.0x) which has been upgraded with each new version to 4.2.7
as well as :
A site which I have upgraded from J3 to J4. I did this a few weeks ago and I have just repeated the exercise today with the same site on a different test sub-domain. This was using a J3 custom template, but I have yet to switch the second upgrade version from Cassiopeia to its J4 custom template. I created a new article, added a full article image in the Images and Links tab and also added an image via a Media custom field. No attributes except 'Alt'. The template version shouldn't make any difference.

For some reason, the height, width and loading attributes are not being written to the #__content.images column in the database.
A check in the admin panel shows that all databases are up to date with no issues.

I'm using PHP 8.0x with mysql on a Linux/Litespeed shared server.

I just have this horrible feeling I'm going to have to recreate the sites - and their content - from scratch :-(

avatar Scrabble96
Scrabble96 - comment - 16 Feb 2023

Further investigation has shown that on updating Joomla, the layouts folder has not been updated. I deleted it on a test site and replaced it with a copy from a fresh installation, but the issue remains.

When you add an image in Images & Links or a media custom field, it should automatically append the dimensions, so the URL looks something like /images/my-image.jpg#joomlaImage://local-images/my-image.jpg?width=700&height=180, but this is not happening on my affected sites, I just have /images/my-image.jpg. Where is the code that makes this happen? Is it some JavaScript? Perhaps it got missed in the updates, as the layouts folder did.

If so, is there a safe way to reinstall Joomla files over an existing installation?

avatar Scrabble96
Scrabble96 - comment - 16 Feb 2023

Ok. I've tracked down the problem. It's JCE Editor free version. I was comparing the events that are triggered when clicking into input id="jform_images_image_intro" and noticed several events - about 22 - were being triggered. With the core TinyMCE it is just three files. I shall contact JCE to report a bug.

avatar brianteeman
brianteeman - comment - 16 Feb 2023

roflmao

Please close this

avatar Scrabble96 Scrabble96 - change - 16 Feb 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-02-16 14:58:22
Closed_By Scrabble96
avatar Scrabble96 Scrabble96 - close - 16 Feb 2023

Add a Comment

Login with GitHub to post a comment