(r io.ReadSeeker, summary ...string)
| 243 | } |
| 244 | |
| 245 | func NewStreamImage(r io.ReadSeeker, summary ...string) *ImageElement { |
| 246 | md5, sha1, length := crypto.ComputeMd5AndSha1AndLength(r) |
| 247 | return &ImageElement{ |
| 248 | Size: uint32(length), |
| 249 | Summary: func() string { |
| 250 | if len(summary) != 0 { |
| 251 | return summary[0] |
| 252 | } |
| 253 | return "" |
| 254 | }(), |
| 255 | Stream: r, |
| 256 | Md5: md5, |
| 257 | Sha1: sha1, |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | func NewFileImage(path string, summary ...string) (*ImageElement, error) { |
| 262 | img, err := os.Open(path) |
no test coverage detected