优化图片导出

pull/358/head
lifei6671 2018-07-12 13:35:48 +08:00
parent 11f1f1d34d
commit fb1962787c
1 changed files with 4 additions and 12 deletions

View File

@ -374,8 +374,6 @@ func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) {
if ff, e := ioutil.ReadFile(spath); e == nil { if ff, e := ioutil.ReadFile(spath); e == nil {
encodeString = base64.StdEncoding.EncodeToString(ff) encodeString = base64.StdEncoding.EncodeToString(ff)
}else{
return
} }
}else{ }else{
client := &http.Client{} client := &http.Client{}
@ -391,21 +389,15 @@ func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) {
if body, err := ioutil.ReadAll(resp.Body);err == nil { if body, err := ioutil.ReadAll(resp.Body);err == nil {
encodeString = base64.StdEncoding.EncodeToString(body) encodeString = base64.StdEncoding.EncodeToString(body)
}else{
return
}
}else{
return
}
}else{
return
} }
} }
}
src = "data:image/" + filepath.Ext(src) + ";base64," + encodeString }
if encodeString != "" {
src = "data:image/" + strings.TrimSuffix(filepath.Ext(src),".") + ";base64," + encodeString
contentSelection.SetAttr("src", src) contentSelection.SetAttr("src", src)
}
} }
}) })