diff --git a/api/geth_backend.go b/api/geth_backend.go index 3015e6be2..870b0ac73 100644 --- a/api/geth_backend.go +++ b/api/geth_backend.go @@ -8,6 +8,7 @@ import ( "encoding/json" "errors" "fmt" + "github.com/davecgh/go-spew/spew" "github.com/status-im/status-go/images" "math/big" "os" @@ -1307,6 +1308,9 @@ func (b *GethStatusBackend) StoreIdentityImage(filepath string, aX, aY, bX, bY i return "", err } + // TODO remove once debug has been resolved + b.log.Info("generated profile images", spew.Sdump(iis, aX, aY, bX, bY)) + idb := images.NewDatabase(b.appDB) err = idb.StoreIdentityImages(iis) if err != nil { diff --git a/images/database.go b/images/database.go index d544dc311..4758f2630 100644 --- a/images/database.go +++ b/images/database.go @@ -87,7 +87,7 @@ func (d *Database) StoreIdentityImages(iis []*IdentityImage) (err error) { defer stmt.Close() for _, ii := range iis { - _, err = stmt.Exec(ii.Name, ii.Payload, ii.Width, ii.Height, ii.FileSize, ii.ResizeTarget) + _, err = stmt.Exec(&ii.Name, &ii.Payload, &ii.Width, &ii.Height, &ii.FileSize, &ii.ResizeTarget) if err != nil { return } diff --git a/images/database_test.go b/images/database_test.go index de1517bfe..22b4b0070 100644 --- a/images/database_test.go +++ b/images/database_test.go @@ -113,7 +113,7 @@ func TestDatabase_GetIdentityImages(t *testing.T) { defer stop() seedTestDB(t, db) - expected := `[{"name":"large","uri":"data:image/png;base64,iVBORw0KGgoAAAANSUg=","width":240,"height":300,"file_size":1024,"resize_target":240},{"name":"thumbnail","uri":"data:image/jpeg;base64,/9j/2wCEAFA3PEY8MlA=","width":80,"height":80,"file_size":256,"resize_target":80}]` + expected := `[{"type":"large","uri":"data:image/png;base64,iVBORw0KGgoAAAANSUg=","width":240,"height":300,"file_size":1024,"resize_target":240},{"type":"thumbnail","uri":"data:image/jpeg;base64,/9j/2wCEAFA3PEY8MlA=","width":80,"height":80,"file_size":256,"resize_target":80}]` oiis, err := db.GetIdentityImages() require.NoError(t, err) @@ -134,11 +134,11 @@ func TestDatabase_GetIdentityImage(t *testing.T) { }{ { SmallDimName, - `{"name":"thumbnail","uri":"data:image/jpeg;base64,/9j/2wCEAFA3PEY8MlA=","width":80,"height":80,"file_size":256,"resize_target":80}`, + `{"type":"thumbnail","uri":"data:image/jpeg;base64,/9j/2wCEAFA3PEY8MlA=","width":80,"height":80,"file_size":256,"resize_target":80}`, }, { LargeDimName, - `{"name":"large","uri":"data:image/png;base64,iVBORw0KGgoAAAANSUg=","width":240,"height":300,"file_size":1024,"resize_target":240}`, + `{"type":"large","uri":"data:image/png;base64,iVBORw0KGgoAAAANSUg=","width":240,"height":300,"file_size":1024,"resize_target":240}`, }, }