From ae7ab126733f1d2c59e327f6120a2bbe792b3476 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sat, 30 Apr 2016 16:04:00 -0400 Subject: Define constants for head-image upload parameters Created class-scope vars to define allowable sizes and types for uploaded user images --- app/model/common.mod.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'app/model/common.mod.php') diff --git a/app/model/common.mod.php b/app/model/common.mod.php index 96326dc..a177c13 100644 --- a/app/model/common.mod.php +++ b/app/model/common.mod.php @@ -7,6 +7,12 @@ require_once "class/user.class.php"; class CommonModel extends MasterModel { + var $HEAD_IMG_MAX_SIZE = 1048576; // 1MB + var $HEAD_IMG_MIME = array( + "image/jpg", + "image/jpeg" + ); + /* * Default action */ @@ -103,7 +109,7 @@ class CommonModel extends MasterModel $user->saveObj(); - if ($form->saveFile($attachment, 5242880, array("image/jpg", "image/jpeg"), "assets/img/heads/" . $user->guid)) + if ($form->saveFile($attachment, $this->HEAD_IMG_MAX_SIZE, $this->HEAD_IMG_MIME, "assets/img/heads/" . $user->guid)) $this->logNotice("Image uploaded"); else $this->logFormErrors($form); -- cgit v1.2.3