mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Merge pull request #333 from nickago/MM-1181
MM-1181 Drawing all images onto a white background, thus removing transparency
This commit is contained in:
@@ -15,6 +15,8 @@ import (
|
||||
"github.com/nfnt/resize"
|
||||
_ "golang.org/x/image/bmp"
|
||||
"image"
|
||||
"image/color"
|
||||
"image/draw"
|
||||
_ "image/gif"
|
||||
"image/jpeg"
|
||||
"io"
|
||||
@@ -138,6 +140,12 @@ func fireAndForgetHandleImages(filenames []string, fileData [][]byte, teamId, ch
|
||||
return
|
||||
}
|
||||
|
||||
// Remove transparency due to JPEG's lack of support of it
|
||||
temp := image.NewRGBA(img.Bounds())
|
||||
draw.Draw(temp, temp.Bounds(), image.NewUniform(color.White), image.Point{}, draw.Src)
|
||||
draw.Draw(temp, temp.Bounds(), img, img.Bounds().Min, draw.Over)
|
||||
img = temp
|
||||
|
||||
// Create thumbnail
|
||||
go func() {
|
||||
thumbWidth := float64(utils.Cfg.ImageSettings.ThumbnailWidth)
|
||||
|
||||
Reference in New Issue
Block a user