Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "Found Unreadable Content" issue when adding an image in the header #321

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions document/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ func (h Header) AddImage(i common.Image) (common.ImageRef, error) {
h.d.Images = append(h.d.Images, r)
fn := fmt.Sprintf("media/image%d.%s", len(h.d.Images), i.Format)
rel := hdrRels.AddRelationship(fn, unioffice.ImageType)
h.d.ContentTypes.EnsureDefault("png", "image/png")
h.d.ContentTypes.EnsureDefault("jpeg", "image/jpeg")
h.d.ContentTypes.EnsureDefault("jpg", "image/jpeg")
h.d.ContentTypes.EnsureDefault("wmf", "image/x-wmf")
h.d.ContentTypes.EnsureDefault(i.Format, "image/"+i.Format)
r.SetRelID(rel.X().IdAttr)
return r, nil
}
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module github.com/unidoc/unioffice

go 1.12
TBouder marked this conversation as resolved.
Show resolved Hide resolved