Skip to content

Set profilepic ImageResizeTransform maxHeight and maxWidth#5468

Merged
valadas merged 11 commits intodnnsoftware:release/9.11.1from
DNNMonster:bugfix/5291-profilepic-mode
Feb 12, 2023
Merged

Set profilepic ImageResizeTransform maxHeight and maxWidth#5468
valadas merged 11 commits intodnnsoftware:release/9.11.1from
DNNMonster:bugfix/5291-profilepic-mode

Conversation

@DNNMonster
Copy link
Copy Markdown
Contributor

Update profilepic mode renderings. Enhances fix for #5291

@valadas
Copy link
Copy Markdown
Contributor

valadas commented Jan 5, 2023

I am confused I thought the problem was defining the max to 10px by default, can you explain the nature of this change...

@DNNMonster
Copy link
Copy Markdown
Contributor Author

If you place a break point in and walk through the code eventually that 10px will become the value used by the ImageResizeTransform class. When requests are made for images in the profilepic mode(not using a maxHeight maxWidth parms) it causes problems with the renderings. The solution in this commit is to avoid using the new hard coded 10px default and set maxHeight/maxWidth to the actual image size when those values are available and the request is a profilepic mode request. This solves the rendering problems in our test environment.

There may be better approaches to solving the issue which I am glad to learn from. We can close this out once it sprouts.

@valadas
Copy link
Copy Markdown
Contributor

valadas commented Jan 6, 2023

But does this not break it for those who do pass maxHeight and maxWidth ?

@DNNMonster
Copy link
Copy Markdown
Contributor Author

Are people using the maxHeight and maxWidth params for profilepic mode?

I tried a global search on DnnImageHandler and I don't think those params are ever used for making requests in profilepic mode. They are used for requests made in secure mode but not for profilepic requests.

We can add an additional check for those params if you want to allow for custom maxHeight maxWidth with profilepics.

@valadas
Copy link
Copy Markdown
Contributor

valadas commented Jan 6, 2023

I was thinking maybe to only revert this change: trilogy-group@e2c302d

Unless I am wrong, people could use that API if they build a module that needs a profile picture.
Also, unless I am wrong, if max is 0 the underlying method called would just use width and height by default...

@mitchelsellers
Copy link
Copy Markdown
Contributor

I believe I'm in favor with @valadas recommendation here, going back to the old behavior for size.

Plus I didn't really care for 10px by 10px as the default anyway

@DNNMonster
Copy link
Copy Markdown
Contributor Author

You are right someone might use the maxHeight maxWidth params for pofilepic mode requests in a module. Right on default max zero handling too.

I have not tested the change you're suggesting. If it fixes the rendering without impacting the rest of the commit then it is better.

I stayed inside the if check that isolated changes to profilepic requests. Setting the default to 0 potentially has broader affects.

I am not sure if there was some initial need to set the 10px.

If you find success with the default at 0 and no side affects then mission accomplished. Close this up.

Copy link
Copy Markdown
Contributor

@valadas valadas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, I prefer the fix this way...
For other reviewers, further down the code there is handling for when the max values are not set by this. So it will in this scenario be unset and work like before instead of enforcing 10x10 when not specified.

@valadas valadas added this to the 9.11.2 milestone Feb 12, 2023
@valadas valadas modified the milestones: 9.11.2, 9.11.1 Feb 12, 2023
@valadas valadas changed the base branch from develop to release/9.11.1 February 12, 2023 00:38
@valadas
Copy link
Copy Markdown
Contributor

valadas commented Feb 12, 2023

Also, since the change in question was done between 9.10.2 and 9.11.1, this is technically a regression bug, so I retargeted the release/9.11.1 branch here.

Copy link
Copy Markdown
Contributor

@mitchelsellers mitchelsellers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this is way better. Thank you.

@valadas valadas merged commit 6aba312 into dnnsoftware:release/9.11.1 Feb 12, 2023
@DNNMonster DNNMonster deleted the bugfix/5291-profilepic-mode branch February 14, 2023 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants