protected function set_type( $type, $overwrite = true )
	{
		if ( !is_null( $type ) )
		{
			if ( !in_array( $type, static::$available_image_types ) )
			{
				throw new CCException( "CCImage - Invalid image type '".$type."'." );
			}

			// don't allow jpg, set to jpeg
			if ( $type === 'jpg' )
			{
				$type = 'jpeg';
			}

			if ( $overwrite )
			{
				$this->type = $type;
			}
		}

		return $type;
	}