? NPM Resource Changed ? Pending

User tests: Successful: Unsuccessful:

avatar travisrisner
travisrisner
31 Jan 2023

Summary of Changes

After updating to 4.2.7, I noticed my custom login images were going outside of the bounds of the box, due to Joomla writing the width in line. I applied a max-width to that image as a possible fix.

Actual result BEFORE applying this Pull Request

Images larger than the login box go outside of the bounding box.

Expected result AFTER applying this Pull Request

Images larger than the bounding box on login fit within the box.

avatar joomla-cms-bot joomla-cms-bot - change - 31 Jan 2023
Category Repository NPM Change
avatar travisrisner travisrisner - open - 31 Jan 2023
avatar travisrisner travisrisner - change - 31 Jan 2023
Status New Pending
avatar travisrisner travisrisner - change - 31 Jan 2023
Title
set max width on image
[4.2] - Admin login - set max width on image
avatar travisrisner travisrisner - edited - 31 Jan 2023
avatar ChristineWk
ChristineWk - comment - 1 Feb 2023

The height: auto is absolutely necessary, otherwise the height=xyz from the IMG tag will be used and is then distorted.


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

avatar ChristineWk ChristineWk - test_item - 1 Feb 2023 - Tested unsuccessfully
avatar ChristineWk
ChristineWk - comment - 1 Feb 2023

I have tested this item ? unsuccessfully on e674317


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

avatar travisrisner
travisrisner - comment - 1 Feb 2023

The height: auto is absolutely necessary, otherwise the height=xyz from the IMG tag will be used and is then distorted.

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

I'm a bit confused. Are you requesting me change the height to auto? I never said anything about height, and my commit was only setting max width.

avatar ChristineWk
ChristineWk - comment - 1 Feb 2023

The height: auto is absolutely necessary, otherwise the height=xyz from the IMG tag will be used and is then distorted.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39766.

I'm a bit confused. Are you requesting me change the height to auto? I never said anything about height, and my commit was only setting max width.

The PR for max-width ist successful, but if you take an high-edgewise image then it will be warped.

avatar travisrisner
travisrisner - comment - 1 Feb 2023

That would be the case if we were setting width, but in this case we are setting max width to ensure images that are too wide for the login box don't go outside the login box. The height style that is set is already in core.

avatar drmenzelit
drmenzelit - comment - 1 Feb 2023

max-width solves the problem for images that are too wide for the login module. If your logo is portrait or square and maybe not so wide then the max-width has no effect, but the max-height and the image looks distorted. Normally it should be max-width:100% in combination with height:auto or width: auto and max-height: 4.4rem to allow the image to resize correctly.

avatar travisrisner travisrisner - change - 1 Feb 2023
Labels Added: NPM Resource Changed ?
avatar drmenzelit
drmenzelit - comment - 1 Feb 2023

You can't combine width, max-width and max-height...

Here some screenshots with different CSS definitions (image size 419 x 542px):

max-height: 4.4rem;

grafik

max-width:100%;
height: auto;
grafik

max-height: 4.4rem;
max-width: 100%;
grafik

max-height: 4.4rem;
width: auto;
grafik

avatar drmenzelit
drmenzelit - comment - 1 Feb 2023

I think, in the case of the logo for the login module, the height of the image is more important than the width. Imagine if someone puts a 800px high image, the login will looks very weird and you will need to scroll to be able to enter your credentials.
IMHO is max-height: 4.4rem and width: auto the better solution... but that should be tested with different kind of logos.

avatar travisrisner
travisrisner - comment - 1 Feb 2023

Agreed

avatar laoneo
laoneo - comment - 1 Feb 2023

Not sure if object-fit would help here somehow.

avatar drmenzelit
drmenzelit - comment - 1 Feb 2023

Not sure if object-fit would help here somehow.

I was thinking about that too, but in this case you want to display the full logo, object-fit will crop the image...

avatar ChristineWk
ChristineWk - comment - 1 Feb 2023

Took a high picture on purpose. Loaded: 525 x 700 px. :-) But there is no new npm package yet for testing.

pr39766-secondtest

Would above example OK for patch, @drmenzelit?

avatar Quy Quy - test_item - 2 Feb 2023 - Tested successfully
avatar Quy
Quy - comment - 2 Feb 2023

I have tested this item successfully on 7e5315e


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

avatar ChristineWk ChristineWk - test_item - 2 Feb 2023 - Tested successfully
avatar ChristineWk
ChristineWk - comment - 2 Feb 2023

pr39766-patch
I have tested this item successfully on 7e5315e


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

avatar Quy Quy - change - 2 Feb 2023
Status Pending Ready to Commit
avatar Quy
Quy - comment - 2 Feb 2023

RTC


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

avatar fancyFranci fancyFranci - change - 3 Feb 2023
Labels Added: ?
avatar fancyFranci fancyFranci - close - 3 Feb 2023
avatar fancyFranci fancyFranci - merge - 3 Feb 2023
avatar fancyFranci fancyFranci - change - 3 Feb 2023
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2023-02-03 20:41:38
Closed_By fancyFranci
avatar fancyFranci
fancyFranci - comment - 3 Feb 2023

Thank you for fixing that!

avatar crystalenka
crystalenka - comment - 4 Feb 2023

Fix works, but can I suggest a slightly different approach? 4.4em is tiny for a lot of logos.

What about something like:

max-height: 15rem;
max-width: 100%;
object-fit: contain;

This bounds the logo by whichever dimension is larger and makes sure it doesn't get distorted, and also makes sure it's not way too tall or too short.

Sorry, I didn't catch this before it was merged!

Add a Comment

Login with GitHub to post a comment