diff options
author | sgiehl <stefan@piwik.org> | 2016-01-04 21:27:18 +0300 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2016-01-12 02:21:47 +0300 |
commit | 5cf6d07af1ca53191922bc501a83323aaa4c5542 (patch) | |
tree | 97e865374f8309e4bcb7aab2e8c5f7858435fc20 /plugins | |
parent | a13158499e9cdf737c66c33901dd690285a74561 (diff) |
supress errors when uploading a broken custom logo
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/CoreAdminHome/CustomLogo.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/CoreAdminHome/CustomLogo.php b/plugins/CoreAdminHome/CustomLogo.php index 76f328e139..32fa636dd3 100644 --- a/plugins/CoreAdminHome/CustomLogo.php +++ b/plugins/CoreAdminHome/CustomLogo.php @@ -196,18 +196,22 @@ class CustomLogo list($width, $height) = getimagesize($file); switch ($_FILES[$uploadFieldName]['type']) { case 'image/jpeg': - $image = imagecreatefromjpeg($file); + $image = @imagecreatefromjpeg($file); break; case 'image/png': - $image = imagecreatefrompng($file); + $image = @imagecreatefrompng($file); break; case 'image/gif': - $image = imagecreatefromgif ($file); + $image = @imagecreatefromgif ($file); break; default: return false; } + if (!is_resource($image)) { + return false; + } + $targetWidth = round($width * $targetHeight / $height); $newImage = imagecreatetruecolor($targetWidth, $targetHeight); |