mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-18 10:37:29 -06:00
return very partial image on first upload
This commit is contained in:
parent
e08c0e55ee
commit
8abfa7751a
5 changed files with 109 additions and 165 deletions
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue