Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] ImageGraph API doesn't adjust height/width when max dimension exceeded changing its ratio #22390

Open
4 tasks done
tsteur opened this issue Jul 12, 2024 · 0 comments
Open
4 tasks done
Labels
Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. triaged

Comments

@tsteur
Copy link
Member

tsteur commented Jul 12, 2024

What happened?

The current ImageGraph API renders images up to 2048px width/height.
Should the width or height exceed either value, then the value is limited to 2048pixel.

This can be ok behaviour.

However, given below URL:
https://demo.matomo.cloud/index.php?module=API&method=ImageGraph.get&idSite=1&apiModule=Actions&apiAction=getPageUrls&token_auth=anonymous&period=day&date=2024-06-12,2024-07-11&filter_sort_column=nb_hits&column=nb_hits&columns=nb_hits&language=en&width=3100&height=1420&fontSize=32&showMetricTitle=0&aliasedGraph=1&legendAppendMetric=0&backgroundColor=efefef&gridColor=dcdcdc&colors=3450A3%2C43a047&legendFontSize=32&cacherand=400098&showMetricTitle=1&showLegend=1&legendAppendMetric=1

What happens is is that Matomo restricts the width 3100 to 2048px but keeps the height at 1420.
I would have expected that when Matomo restricts the width or height that it ensures the ratio of the image is kept.

This is not the case and thus the image looks funny in our native Android/iOS mobile app where we often request images in > 3000px wide or high. The images look stretched and not professional.

image

What should happen?

When restricting the max width or height, keep the ratio of the requested dimension.

Eg above requested was 3100x1420.

I would have expected dimensions to be roughly 2048x938px.

How can this be reproduced?

Open https://demo.matomo.cloud/index.php?module=API&method=ImageGraph.get&idSite=1&apiModule=Actions&apiAction=getPageUrls&token_auth=anonymous&period=day&date=2024-06-12,2024-07-11&filter_sort_column=nb_hits&column=nb_hits&columns=nb_hits&language=en&width=3100&height=1420&fontSize=32&showMetricTitle=0&aliasedGraph=1&legendAppendMetric=0&backgroundColor=efefef&gridColor=dcdcdc&colors=3450A3%2C43a047&legendFontSize=32&cacherand=400098&showMetricTitle=1&showLegend=1&legendAppendMetric=1

Inspect width/height

Matomo version

5

PHP version

No response

Server operating system

No response

What browsers are you seeing the problem on?

No response

Computer operating system

No response

Relevant log output

No response

Validations

@tsteur tsteur added Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member labels Jul 12, 2024
@tsteur tsteur changed the title [Bug] ImageGraph API doesn't adjust height/width when max dimension exceeded changing it's ratio [Bug] ImageGraph API doesn't adjust height/width when max dimension exceeded changing its ratio Jul 12, 2024
@randy-innocraft randy-innocraft added triaged and removed To Triage An issue awaiting triage by a Matomo core team member labels Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. triaged
Projects
None yet
Development

No branches or pull requests

2 participants