mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 08:05:43 -06:00
Merge pull request #10150 from jomenxiao/jomenxiao/render_setting_lang
[render image]add encoding param
This commit is contained in:
commit
5d70a36ad8
@ -24,6 +24,7 @@ func RenderToPng(c *middleware.Context) {
|
|||||||
OrgId: c.OrgId,
|
OrgId: c.OrgId,
|
||||||
Timeout: queryReader.Get("timeout", "60"),
|
Timeout: queryReader.Get("timeout", "60"),
|
||||||
Timezone: queryReader.Get("tz", ""),
|
Timezone: queryReader.Get("tz", ""),
|
||||||
|
Encoding: queryReader.Get("encoding", ""),
|
||||||
}
|
}
|
||||||
|
|
||||||
pngPath, err := renderer.RenderToPng(renderOpts)
|
pngPath, err := renderer.RenderToPng(renderOpts)
|
||||||
|
@ -27,6 +27,7 @@ type RenderOpts struct {
|
|||||||
Timeout string
|
Timeout string
|
||||||
OrgId int64
|
OrgId int64
|
||||||
Timezone string
|
Timezone string
|
||||||
|
Encoding string
|
||||||
}
|
}
|
||||||
|
|
||||||
var ErrTimeout = errors.New("Timeout error. You can set timeout in seconds with &timeout url parameter")
|
var ErrTimeout = errors.New("Timeout error. You can set timeout in seconds with &timeout url parameter")
|
||||||
@ -95,6 +96,10 @@ func RenderToPng(params *RenderOpts) (string, error) {
|
|||||||
"renderKey=" + renderKey,
|
"renderKey=" + renderKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if params.Encoding != "" {
|
||||||
|
cmdArgs = append([]string{fmt.Sprintf("--output-encoding=%s", params.Encoding)}, cmdArgs...)
|
||||||
|
}
|
||||||
|
|
||||||
cmd := exec.Command(binPath, cmdArgs...)
|
cmd := exec.Command(binPath, cmdArgs...)
|
||||||
stdout, err := cmd.StdoutPipe()
|
stdout, err := cmd.StdoutPipe()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user