diff --git a/components/options.php b/components/options.php index bdaea2cbfd438f6474243dde4e88eef3f372abff..e7612671d2a3e5a1cad9b996a47a04cf0f9a25b5 100644 --- a/components/options.php +++ b/components/options.php @@ -154,8 +154,15 @@ function hackergotchiPath($username) { // Takes an entry from $_FILES and makes this the new hackergotchi function updateHackergotchi($fileDetails) { global $session; - if ( ((list($width, $height, $type, $attr) = @getimagesize($fileDetails['tmp_name'])) !== false) && - ($type == IMAGETYPE_PNG) && ($width <= 128) && ($height <= 128)) { + if ( ((list($width, $height, $type, $attr) = @getimagesize($fileDetails['tmp_name'])) !== false)) { + + if ($type != IMAGETYPE_PNG) { + trigger_error("Uploaded hackergotchi is not in PNG format. Please convert your image to PNG and try again.", E_USER_ERROR); + return FALSE; + } else if (($width > 128) || ($height > 128)) { + trigger_error("Uploaded hackergotchi is too large. Hackergotchis must be 128x128 pixels or smaller.", E_USER_ERROR); + return FALSE; + } $imagefilepath = hackergotchiPath($session->username); @@ -163,7 +170,7 @@ function updateHackergotchi($fileDetails) { if( move_uploaded_file($fileDetails['tmp_name'], $imagefilepath) && chmod($imagefilepath, 0644) ) { return TRUE; } - } + } // We should have returned True by now trigger_error("There was an error updating your hackergotchi. Please contact admin.", E_USER_ERROR); return FALSE;