Пример #1
0
func (parser *Parser) parse(req *http.Request, params imageserver.Params) error {
	if err := imageserver_http.ParseQueryInt("width", req, params); err != nil {
		return err
	}
	if err := imageserver_http.ParseQueryInt("height", req, params); err != nil {
		return err
	}
	if err := imageserver_http.ParseQueryBool("fill", req, params); err != nil {
		return err
	}
	if err := imageserver_http.ParseQueryBool("ignore_ratio", req, params); err != nil {
		return err
	}
	if err := imageserver_http.ParseQueryBool("only_shrink_larger", req, params); err != nil {
		return err
	}
	if err := imageserver_http.ParseQueryBool("only_enlarge_smaller", req, params); err != nil {
		return err
	}
	if err := imageserver_http.ParseQueryBool("extent", req, params); err != nil {
		return err
	}
	if err := imageserver_http.ParseQueryInt("quality", req, params); err != nil {
		return err
	}
	imageserver_http.ParseQueryString("background", req, params)
	imageserver_http.ParseQueryString("format", req, params)
	return nil
}
Пример #2
0
func parse(req *http.Request, params imageserver.Params) error {
	if err := imageserver_http.ParseQueryInt("width", req, params); err != nil {
		return err
	}
	if err := imageserver_http.ParseQueryInt("height", req, params); err != nil {
		return err
	}
	imageserver_http.ParseQueryString("interpolation", req, params)
	imageserver_http.ParseQueryString("mode", req, params)
	return nil
}
Пример #3
0
func (prs *ResizeParser) parse(req *http.Request, params imageserver.Params) error {
	if err := imageserver_http.ParseQueryInt("width", req, params); err != nil {
		return err
	}
	if err := imageserver_http.ParseQueryInt("height", req, params); err != nil {
		return err
	}
	imageserver_http.ParseQueryString("resampling", req, params)
	imageserver_http.ParseQueryString("mode", req, params)
	return nil
}
Пример #4
0
func (parser *Parser) parse(req *http.Request, params imageserver.Params) error {
	// parse bool params
	boolParams := []string{
		"ignore_ratio",
		"fill",
		"only_shrink_larger",
		"only_enlarge_smaller",
		"extent",
		"monochrome",
		"grey",
		"no_strip",
		"trim",
		"no_interlace",
		"flip",
		"flop",
	}
	for _, bp := range boolParams {
		err := imageserver_http.ParseQueryBool(bp, req, params)
		if err != nil {
			return err
		}
	}

	// parse integer params
	intParams := []string{
		"w",
		"h",
		"rotate",
		"q",
	}
	for _, ip := range intParams {
		err := imageserver_http.ParseQueryInt(ip, req, params)
		if err != nil {
			return err
		}
	}

	// parse string params
	stringParams := []string{
		"bg",
		"gravity",
		"crop",
		"format",
	}
	for _, sp := range stringParams {
		imageserver_http.ParseQueryString(sp, req, params)
	}
	return nil
}
Пример #5
0
// Parse implements Parser.
func (parser *QualityParser) Parse(req *http.Request, params imageserver.Params) error {
	return imageserver_http.ParseQueryInt("quality", req, params)
}