return very partial image on first upload

This commit is contained in:
tsmethurst 2022-01-03 17:37:38 +01:00
commit 8abfa7751a
5 changed files with 109 additions and 165 deletions

View file

@ -1,7 +1,34 @@
package media
import gtsmodel "github.com/superseriousbusiness/gotosocial/internal/db/bundb/migrations/20211113114307_init"
import (
"fmt"
"sync"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
)
type Media struct {
Attachment *gtsmodel.MediaAttachment
mu sync.Mutex
attachment *gtsmodel.MediaAttachment
rawData []byte
}
func (m *Media) Thumb() (*ImageMeta, error) {
m.mu.Lock()
thumb, err := deriveThumbnail(m.rawData, m.attachment.File.ContentType)
if err != nil {
return nil, fmt.Errorf("error deriving thumbnail: %s", err)
}
m.attachment.Blurhash = thumb.blurhash
aaaaaaaaaaaaaaaa
}
func (m *Media) PreLoad() {
m.mu.Lock()
defer m.mu.Unlock()
}
func (m *Media) Load() {
m.mu.Lock()
defer m.mu.Unlock()
}