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
Conversation
@@ -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); |
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.
I wonder if the @
actually needed as it would return false
on any failure or not?
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.
Just asking as we kinda try to get rid of using @
:)
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.
It throws a warning if the file is invalid, which might be shown as notification.
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.
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
f380362
to
83af7e3
Compare
83af7e3
to
5160e1f
Compare
Better error handling for custom logo upload
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.
fixes #7264