From 3c4d7755d0a88c148884e0cbb90b327a96d87973 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Wed, 19 Apr 2017 22:45:18 -0400 Subject: Add object function setBgImg() --- app/class/object.class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'app/class') diff --git a/app/class/object.class.php b/app/class/object.class.php index 8d889e7..f8f5460 100644 --- a/app/class/object.class.php +++ b/app/class/object.class.php @@ -25,6 +25,7 @@ class object extends table * Constants used for uploading images */ public const HEAD_MAXSIZE = 1048576; // 1Mb + public const BG_MAXSIZE = 1048576; // 1Mb public const IMAGE_MIME = array( "image/jpeg", "image/jpg", @@ -201,6 +202,17 @@ class object extends table return unlink("dynmic/heads/" . $this->guid); } + + /* + * Set the background image for this object, overwriting any + * existing image. $image should be an uploaded file to PHP, + * still unhandled. + */ + public function setBgImg(array $image) : bool + { + $path = "dynmic/bgs/" . $this->guid; + return saveFile($image, $path, self::BG_MAXSIZE, self::IMAGE_MIME); + } } ?> -- cgit v1.2.3