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
Added config option for custom tracking image #17879
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @bx80,
thanks for your contribution!
I had a quick look at the code and left a couple of suggestions. Once PHPCS is fixed and tests are running through I will quickly test the functionality locally so we can merge that soon :-)
Improved brevity Co-authored-by: Stefan Giehl <stefan@matomo.org>
Improved brevity Co-authored-by: Stefan Giehl <stefan@matomo.org>
Remove unnecessary debug comment Co-authored-by: Stefan Giehl <stefan@matomo.org>
Thanks for the suggestions, much appreciated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, left a few comments to clarify
…e mime type for image strings, switched to using file_get_contents, is_file and is_readable for image file loading
@bx80 it seems the tests you have added are failing. See https://app.travis-ci.com/github/matomo-org/matomo/jobs/531164790#L735 |
The tests were failing because of the image recreate commit I'd previous added, a recreated image wouldn't match the original source image. I've reverted image recreation change due to performance and so the tests should now pass. |
This issue is in "needs review" but there has been no activity for 7 days. ping @matomo-org/core-reviewers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my point of view this should be ready to merge. Guess it's kind of expected that configuring a broken inline image (like c4==
) also serves this broken image.
@tsteur shall we merge this for 4.5?
@sgiehl could you create an FAQ on matomo.org about how to change the tracking image before merging it? If we send a broken image when misconfigured then we should mention this also in the FAQ. We would need to mention how they can test the image. |
Thanks @bx80! |
Description:
fixes #2672 Custom image to replace default 1x1 GIF image
Added a new config option which may be used to specify a custom image to override the default 1x1 transparent gif.
Either a image file location (with full path) or a base64 image string may be used.
[Tracker] custom_image = /path/to/my_custom_image.png
or
[Tracker] custom_image = "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAIAAAACDbGyAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5QgLFiABlwQnpwAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAUSURBVAjXY/wjLMyABJgYUAGpfABbJQEsALGyNgAAAABJRU5ErkJggg=="
Two unit tests are included which set the config option for both an image file and base64 image string, then check the respective tracker responses against the original image data.
Review