Generate preview regardless of HasPreviewImage value (#16535)
Automatic Merge
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
1367418e3c
Коммит
6c976c3b06
@@ -404,6 +404,18 @@ func TestUploadFiles(t *testing.T) {
|
|||||||
expectedImageHasPreview: []bool{true},
|
expectedImageHasPreview: []bool{true},
|
||||||
expectedCreatorId: th.BasicUser.Id,
|
expectedCreatorId: th.BasicUser.Id,
|
||||||
},
|
},
|
||||||
|
// animated GIF
|
||||||
|
{
|
||||||
|
title: "Happy image thumbnail/preview 12",
|
||||||
|
names: []string{"testgif.gif"},
|
||||||
|
expectedImageThumbnailNames: []string{"testgif_expected_thumbnail.jpg"},
|
||||||
|
expectedImagePreviewNames: []string{"testgif_expected_preview.jpg"},
|
||||||
|
expectImage: true,
|
||||||
|
expectedImageWidths: []int{118},
|
||||||
|
expectedImageHeights: []int{118},
|
||||||
|
expectedImageHasPreview: []bool{false},
|
||||||
|
expectedCreatorId: th.BasicUser.Id,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: "Happy admin",
|
title: "Happy admin",
|
||||||
client: th.SystemAdminClient,
|
client: th.SystemAdminClient,
|
||||||
|
|||||||
24
app/file.go
24
app/file.go
@@ -793,19 +793,19 @@ func (t *UploadFileTask) postprocessImage(file io.Reader) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wg.Add(1)
|
wg.Add(3)
|
||||||
if t.fileinfo.HasPreviewImage {
|
// Generating thumbnail and preview regardless of HasPreviewImage value.
|
||||||
wg.Add(2)
|
// This is needed on mobile in case of animated GIFs.
|
||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
writeJPEG(genThumbnail(decoded), t.fileinfo.ThumbnailPath)
|
writeJPEG(genThumbnail(decoded), t.fileinfo.ThumbnailPath)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
writeJPEG(genPreview(decoded), t.fileinfo.PreviewPath)
|
||||||
|
}()
|
||||||
|
|
||||||
go func() {
|
|
||||||
defer wg.Done()
|
|
||||||
writeJPEG(genPreview(decoded), t.fileinfo.PreviewPath)
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
if t.fileinfo.MiniPreview == nil {
|
if t.fileinfo.MiniPreview == nil {
|
||||||
|
|||||||
Двоичные данные
tests/testgif_expected_preview.jpg
Обычный файл
Двоичные данные
tests/testgif_expected_preview.jpg
Обычный файл
Двоичный файл не отображается.
|
После Ширина: | Высота: | Размер: 6.7 KiB |
Двоичные данные
tests/testgif_expected_thumbnail.jpg
Обычный файл
Двоичные данные
tests/testgif_expected_thumbnail.jpg
Обычный файл
Двоичный файл не отображается.
|
После Ширина: | Высота: | Размер: 5.2 KiB |
Ссылка в новой задаче
Block a user