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

Better error handling for custom logo upload #9471

Merged
merged 3 commits into from Jan 11, 2016
Merged

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Jan 4, 2016

As described in #7264 some errors while uploading a custom logo might occur.
Those errors weren't shown directly. Instead noting happened and the error is displayed after the next page reload.

To improve that behavior, I've suppressed those errors that might occur while opening an invalid file and implemented a simple error message that is displayed when the upload failed.

image

fixes #7264

@sgiehl sgiehl added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Jan 4, 2016
@@ -196,18 +196,22 @@ private function uploadImage($uploadFieldName, $targetHeight, $userPath)
list($width, $height) = getimagesize($file);
switch ($_FILES[$uploadFieldName]['type']) {
case 'image/jpeg':
$image = imagecreatefromjpeg($file);
$image = @imagecreatefromjpeg($file);
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if the @ actually needed as it would return false on any failure or not?

Copy link
Member

Choose a reason for hiding this comment

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

Just asking as we kinda try to get rid of using @ :)

Copy link
Member Author

Choose a reason for hiding this comment

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

It throws a warning if the file is invalid, which might be shown as notification.

Copy link
Member

Choose a reason for hiding this comment

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

Cool, thx. Can you have a look at the other comment? Not sure if something is do on the other comment. If not, feel free to merge

@sgiehl sgiehl force-pushed the customlogo_improvements branch 2 times, most recently from f380362 to 83af7e3 Compare January 11, 2016 22:22
@tsteur tsteur added this to the 2.16.0 milestone Jan 11, 2016
tsteur added a commit that referenced this pull request Jan 11, 2016
Better error handling for custom logo upload
@tsteur tsteur merged commit d6b24cc into master Jan 11, 2016
@tsteur tsteur deleted the customlogo_improvements branch January 11, 2016 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants