Add min_width and min_height options to the Upload class

(manually implementing outdated PR #636)
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index 5d163fb..4f65c9e 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -59,6 +59,20 @@
 	public $max_height		= 0;
 
 	/**
+	 * Minimum image width
+	 *
+	 * @var	int
+	 */
+	public $min_width		= 0;
+
+	/**
+	 * Minimum image height
+	 *
+	 * @var	int
+	 */
+	public $min_height		= 0;
+
+	/**
 	 * Maximum filename length
 	 *
 	 * @var	int
@@ -269,6 +283,8 @@
 					'max_size'			=> 0,
 					'max_width'			=> 0,
 					'max_height'			=> 0,
+					'min_width'			=> 0,
+					'min_height'			=> 0,
 					'max_filename'			=> 0,
 					'max_filename_increment'	=> 100,
 					'allowed_types'			=> '',
@@ -674,6 +690,32 @@
 	// --------------------------------------------------------------------
 
 	/**
+	 * Set minimum image width
+	 *
+	 * @param	int	$n
+	 * @return	void
+	 */
+	public function set_min_width($n)
+	{
+		$this->min_width = ((int) $n < 0) ? 0 : (int) $n;
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Set minimum image height
+	 *
+	 * @param	int	$n
+	 * @return	void
+	 */
+	public function set_min_height($n)
+	{
+		$this->min_height = ((int) $n < 0) ? 0 : (int) $n;
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
 	 * Set Allowed File Types
 	 *
 	 * @param	string	$types
@@ -859,6 +901,16 @@
 			{
 				return FALSE;
 			}
+
+			if ($this->min_width > 0 && $D[0] < $this->min_width)
+			{
+				return FALSE;
+			}
+
+			if ($this->min_height > 0 && $D[1] < $this->min_height)
+			{
+				return FALSE;
+			}
 		}
 
 		return TRUE;