public function writeImage( $image, $file, $type) {
		switch ($type) {
			case 2:	//JPEG
			Imagejpeg( $image, $file);
			break;
			
			case 3:	//PNG
			Imagepng( $image, $file);
			break;
			
			default:
			$this->errorMsg="File format not supported.";
		}
	}