media.go 686 B

12345678910111213141516171819202122232425
  1. /*
  2. Package media handles the pictures, video and audio inside office
  3. documents: data URLs in and out, the MIME types and file extensions of
  4. media parts, sniffing an image's format and natural size, the media?file=
  5. links the editors keep for pictures from the user's storage, and the
  6. numbered media entries the package writers collect.
  7. */
  8. package media
  9. import (
  10. "bytes"
  11. "image"
  12. )
  13. // ImageConfig probes image bytes for their natural pixel size (decoders
  14. // are registered by the docx writer's blank imports)
  15. func ImageConfig(data []byte) (image.Config, string, error) {
  16. return image.DecodeConfig(bytes.NewReader(data))
  17. }
  18. type Entry struct {
  19. Index int
  20. Ext string
  21. Data []byte
  22. }