? Release Blocker ? a11y ? Pending

User tests: Successful: Unsuccessful:

avatar dgrammatiko
dgrammatiko
7 Oct 2021

Pull Request for Issue #35779.

THIS IS A RELEASE BLOCKER

Images in many layouts are totally broken

Summary of Changes

Testing Instructions

Test that images in all these views are rendering correctly.

Create a new contact and use the image field
Create a menu item contact category and check the front end that the image html is not having the hash part
Create a menu item single contact and check the front end that the image html is not having the hash part

Create an article with both intro and full images
Create a menu item articles category blog and check the front end that the image html is not having the hash part
Also check on the article view (clicking on the title) the image html is not having the hash part

Create a new newsfeed with the link: https://www.joomla.org/announcements.feed?height=660&keepthis=632&tb_iframe=true&type=rss, make sure to set both the first and second images
Create a menu item newsfeed category and check the front end that the image html is not having the hash part
Also check the the actual feed has the first and second image with the hash

Actual result BEFORE applying this Pull Request

Broken

Expected result AFTER applying this Pull Request

Fixed

Documentation Changes Required

Not these particular changes but the process of cleaning the URL from the media field should definitely be documented

avatar dgrammatiko dgrammatiko - open - 7 Oct 2021
avatar dgrammatiko dgrammatiko - change - 7 Oct 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 7 Oct 2021
Category Front End com_contact com_content com_newsfeeds Modules
avatar dgrammatiko dgrammatiko - change - 7 Oct 2021
The description was changed
avatar dgrammatiko dgrammatiko - edited - 7 Oct 2021
avatar dgrammatiko dgrammatiko - change - 7 Oct 2021
Labels Added: Release Blocker ?
avatar joomla-cms-bot joomla-cms-bot - change - 7 Oct 2021
Category Front End com_contact com_content com_newsfeeds Modules Front End com_contact com_content com_newsfeeds Modules Templates (site)
ce2e00f 8 Oct 2021 avatar dgrammatiko more
45ec5c4 8 Oct 2021 avatar dgrammatiko more
avatar dgrammatiko dgrammatiko - change - 9 Oct 2021
Labels Added: a11y ?
avatar joomla-cms-bot joomla-cms-bot - change - 10 Oct 2021
Category Front End com_contact com_content com_newsfeeds Modules Templates (site) Front End com_contact com_content com_newsfeeds Modules
avatar joomdonation
joomdonation - comment - 16 Oct 2021

Hmm. We are repeating the same code again and again. Is there a way to add a new helper like lazyImage to handle this?

avatar dgrammatiko
dgrammatiko - comment - 16 Oct 2021

Is there a way to add a new helper like lazyImage to handle this?

My approach would be to add a new JLayout and not another HTMLHelper thing. The first is very approachable to any front ender the second requires writing a plugin to override it. Basically, the HTMLHelper (s) should be used only for logic/processing and never for spitting out HTML.

My 2c

avatar joomdonation
joomdonation - comment - 16 Oct 2021

That should work, too. If we do not have to repeat that same code again and again, and have a way for third party developers to re-use the code, we should be fine.

avatar richard67
richard67 - comment - 23 Oct 2021

@dgrammatiko Reading the above discussion it's not 100% clear for me: Is this PR ready for testing now, or do we have to wait for some changes?

avatar dgrammatiko
dgrammatiko - comment - 23 Oct 2021

Reading the above discussion it's not 100% clear for me: Is this PR ready for testing now, or do we have to wait for some changes?

The changes are valid but also it's valid that at the current state we have a lot of duplicate code. I will add a new layout for rendering images and use it core wide

avatar richard67
richard67 - comment - 23 Oct 2021

I will add a new layout for rendering images and use it core wide

@dgrammatiko In this PR here or in another, future one?

avatar joomla-cms-bot joomla-cms-bot - change - 23 Oct 2021
Category Front End com_contact com_content com_newsfeeds Modules Front End com_contact com_content com_newsfeeds Layout Modules
avatar dgrammatiko
dgrammatiko - comment - 23 Oct 2021

@richard67 in this PR
@joomdonation is this any better?

avatar joomdonation
joomdonation - comment - 30 Oct 2021

@dgrammatiko I still have a question about the code. To render an image, we are using this code

echo LayoutHelper::render(
		'joomla.html.image',
		[
			'image' => [
				'src' => $item->imageSrc,
				'alt' => $item->imageAlt,
				'attributes' => []
			],
		]
	);

I wonder why we need to use 'image' key here? Shouldn't something like below is faster (to write):

echo LayoutHelper::render(
		'joomla.html.image',
		[		
			'src' => $item->imageSrc,
			'alt' => $item->imageAlt,
			'attributes' => []			
		]
	);

And for additional attributes like alt, attributes, can we not pass it if the data is not available?

Not really an issue with code. Just some questions from me.

avatar dgrammatiko
dgrammatiko - comment - 30 Oct 2021

I wonder why we need to use 'image' key here? Shouldn't something like below is faster (to write)

Yes having just the attributes for the image element would be easier, the reason I used the key ‘image’ has more to do with future expanding the layout to render a figure with caption and/or picture with source nested elements (responsive images). Having the values under a named key will make that easier, instead of naming the keys with funny names . That said jlayouts support sublayouts so in the future this could be a sub layout of figure?
That’s a valid question and I have no clue if this is better than using a plain array and deal with the figure/picture using sublayouts

avatar joomdonation
joomdonation - comment - 31 Oct 2021

Without seeing the actual code, I'm unsure if it is good or bad. I think my questions about optional attributes still valid, with or without using image key

And for additional attributes like alt, attributes, can we not pass it if the data is not available?

Could anyone else looks at the current implementation before we doing real test? @Fedik ?

avatar Fedik
Fedik - comment - 31 Oct 2021

I agree with @joomdonation #35780 (comment)
Make it simple ?
In the future no one will remember why it made like that.

For picture we can check for source variable or have another layout, kind of joomla.html.picture, when it will be need.
(In my code I use similar blabla.html.image and blabla.html.picture)

avatar dgrammatiko
dgrammatiko - comment - 3 Nov 2021

@joomdonation @Fedik is this version any better?

687d583 3 Nov 2021 avatar dgrammatiko meh
avatar Fedik
Fedik - comment - 3 Nov 2021

yes and no ;)

Please move htmlspecialchars stuff inside image layout,
there you can use $this->escape($blabla);

This way we can be sure that the values is always escaped,

4c54bb5 3 Nov 2021 avatar dgrammatiko Redo
avatar dgrammatiko
dgrammatiko - comment - 4 Nov 2021

@Fedik are the changes ok now?

avatar Fedik
Fedik - comment - 4 Nov 2021

Looks good to me :)

avatar drmenzelit drmenzelit - test_item - 21 Nov 2021 - Tested successfully
avatar drmenzelit
drmenzelit - comment - 21 Nov 2021

I have tested this item successfully on 4c54bb5

Tested with category blog.

Image url before patch:

imagebefore

Image url after patch:

imageafter

In other views (module newsflash or contacts) I don't see changes in the image url.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35780.
avatar Quy
Quy - comment - 22 Dec 2021

Please see the alt attribute.

<img src="/Joomla_4.0.6-dev+pr.35780-Development-Full_Package/images/sampledata/cassiopeia/nasa2-400.jpg" itemprop="image" alt="alt=&quot;&quot;">

35780

avatar dgrammatiko
dgrammatiko - comment - 22 Dec 2021

@Quy it should fine now, thanks

avatar uglyeoin
uglyeoin - comment - 24 Dec 2021

@dgrammatiko please can you help me with testing instructions? I'm happy to test but I don't understand how to. The previous issue you linked to mentions we can see images before hand. What should I be looking for? I don't want to accept a test by accident with incorrect testing.

avatar dgrammatiko dgrammatiko - change - 25 Dec 2021
The description was changed
avatar dgrammatiko dgrammatiko - edited - 25 Dec 2021
avatar dgrammatiko
dgrammatiko - comment - 25 Dec 2021

@uglyeoin I've updated the testing instructions, hopefully it's easy to follow

avatar Quy
Quy - comment - 28 Dec 2021

For Article Category Blog, no width, height, and loading attributes.

Before PR:

<figure class="left item-image">
	<img src="/joomla-cms-4.0-dev/images/sampledata/fruitshop/tamarind.jpg"
			 			 itemprop="image"
			width="375" height="488" loading="lazy"	/>
			<figcaption class="caption">Full Caption</figcaption>

After PR:

<figure class="left item-image">
	<img src="/joomla-cms-4.0-dev/images/sampledata/fruitshop/tamarind.jpg" itemprop="image" alt="">			<figcaption class="caption">Full Caption</figcaption>
	</figure>
avatar dgrammatiko
dgrammatiko - comment - 30 Dec 2021

For Article Category Blog, no width, height, and loading attributes.

That was a bug, I thought I knew the API I introduced many months ago but I was wrong. My bad. It should be fine now

avatar Quy
Quy - comment - 30 Dec 2021

For Contact Categories, on the front end:

<img src="/joomla-cms-4.0-dev/images/3.webp#joomlaImage://local-images/3.webp?width=1280&height=720" >

avatar joomla-cms-bot joomla-cms-bot - change - 31 Dec 2021
Category Front End com_contact com_content com_newsfeeds Modules Layout Front End com_contact com_content com_newsfeeds Layout Libraries Modules
avatar Quy
Quy - comment - 3 Jan 2022

Please resolve conflicts.

avatar Quy
Quy - comment - 3 Jan 2022

I have tested this item successfully on 4c54bb5

Thank you!!!


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

avatar Quy Quy - test_item - 3 Jan 2022 - Tested successfully
avatar dgrammatiko
dgrammatiko - comment - 3 Jan 2022

@Quy thanks for all the fixes and the tests

avatar alikon
alikon - comment - 5 Jan 2022

I have tested this item successfully on 4c54bb5


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

avatar alikon alikon - test_item - 5 Jan 2022 - Tested successfully
avatar alikon alikon - change - 5 Jan 2022
Status Pending Ready to Commit
avatar alikon
alikon - comment - 5 Jan 2022

RTC


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

avatar dgrammatiko
dgrammatiko - comment - 5 Jan 2022
avatar laoneo
laoneo - comment - 5 Jan 2022

I have tested this item successfully on 4c54bb5


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

avatar laoneo
laoneo - comment - 5 Jan 2022

I have tested this item successfully on 4c54bb5


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

avatar laoneo laoneo - test_item - 5 Jan 2022 - Tested successfully
avatar laoneo
laoneo - comment - 5 Jan 2022

By the way, tested also with DPMedia and the hash is removed.

avatar dgrammatiko
dgrammatiko - comment - 5 Jan 2022

By the way, tested also with DPMedia and the hash is removed.

That was the whole point of this PR: provide one simple JLayout to fix the hash problem universally. Now we need to backport it to 3.x and ask every DEV to render all their images using this layout...

avatar wilsonge wilsonge - close - 8 Jan 2022
avatar wilsonge wilsonge - merge - 8 Jan 2022
avatar wilsonge wilsonge - change - 8 Jan 2022
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2022-01-08 23:03:06
Closed_By wilsonge
Labels Added: ?
avatar wilsonge
wilsonge - comment - 8 Jan 2022

Thanks!

Add a Comment

Login with GitHub to post a comment