diff options
-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); |