Skip to content

Commit

Permalink
Support HEIC image thumbnails
Browse files Browse the repository at this point in the history
  • Loading branch information
turt2live committed Aug 27, 2023
1 parent 6707bbb commit c6bbb62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ path/server, for example, then you can simply update the path in the config for
* Thumbnailing support for:
* BMP images.
* TIFF images.
* HEIC images.
* New metrics:
* HTTP response times.
* Age of downloaded/accessed media.
Expand Down
5 changes: 3 additions & 2 deletions thumbnailing/i/heif.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ import (
_ "github.com/strukturag/libheif/go/heif"
"github.com/turt2live/matrix-media-repo/common/rcontext"
"github.com/turt2live/matrix-media-repo/thumbnailing/m"
"github.com/turt2live/matrix-media-repo/util"
)

type heifGenerator struct {
}

func (d heifGenerator) supportedContentTypes() []string {
return []string{"image/heif"}
return []string{"image/heif", "image/heic"}
}

func (d heifGenerator) supportsAnimation() bool {
return true
}

func (d heifGenerator) matches(img io.Reader, contentType string) bool {
return contentType == "image/heif"
return util.ArrayContains(d.supportedContentTypes(), contentType)
}

func (d heifGenerator) GetOriginDimensions(b io.Reader, contentType string, ctx rcontext.RequestContext) (bool, int, int, error) {
Expand Down

0 comments on commit c6bbb62

Please sign in to comment.