Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsgiehl <stefan@piwik.org>2016-01-04 21:27:18 +0300
committersgiehl <stefan@piwik.org>2016-01-12 02:21:47 +0300
commit5cf6d07af1ca53191922bc501a83323aaa4c5542 (patch)
tree97e865374f8309e4bcb7aab2e8c5f7858435fc20 /plugins/CoreAdminHome/CustomLogo.php
parenta13158499e9cdf737c66c33901dd690285a74561 (diff)
supress errors when uploading a broken custom logo
Diffstat (limited to 'plugins/CoreAdminHome/CustomLogo.php')
-rw-r--r--plugins/CoreAdminHome/CustomLogo.php10
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);