imageEditConvertURL 把字符串(image_url)解析为 editImageInput。
(client httpclient.AuroraHttpClient, raw string)
| 1063 | |
| 1064 | // imageEditConvertURL 把字符串(image_url)解析为 editImageInput。 |
| 1065 | func imageEditConvertURL(client httpclient.AuroraHttpClient, raw string) (editImageInput, bool, error) { |
| 1066 | raw = strings.TrimSpace(raw) |
| 1067 | if raw == "" { |
| 1068 | return editImageInput{}, false, nil |
| 1069 | } |
| 1070 | if strings.HasPrefix(raw, "data:") { |
| 1071 | item, err := imageEditDecodeDataURL(raw) |
| 1072 | return item, true, err |
| 1073 | } |
| 1074 | if strings.HasPrefix(raw, "http://") || strings.HasPrefix(raw, "https://") { |
| 1075 | item, err := imageEditDownloadHTTPURL(client, raw) |
| 1076 | return item, true, err |
| 1077 | } |
| 1078 | // 非 URL、非 data URL:当 base64 处理 |
| 1079 | item, err := imageEditReadJSONImage([]byte(raw), "image.png", "image/png") |
| 1080 | return item, true, err |
| 1081 | } |
| 1082 | |
| 1083 | // resolveEditImageSources 把 JSON images 数组 / image_url 字段解析为 []editImageInput。 |
| 1084 | func resolveEditImageSources(c *gin.Context, body map[string]interface{}, client httpclient.AuroraHttpClient) ([]editImageInput, error) { |
no test coverage detected