Skip to content

Commit

Permalink
encode img before uploading to ipfs
Browse files Browse the repository at this point in the history
  • Loading branch information
slandymani committed Oct 2, 2024
1 parent 8d36ca6 commit 447b091
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions kvasir/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,6 @@ func uploadToIPFS(c *Context, l *Logger, file []byte, report ReportMsgWithKey) (
os.Remove(string(file))
}()

// Connect to local IPFS node
sh := shell.NewShell(c.ipfs)
// Upload the image to IPFS
pngCID, err := sh.Add(pngFile, shell.Pin(true))
if err != nil {
return "", err
}

img, err := png.Decode(pngFile)
if err != nil {
return "", err
Expand All @@ -283,6 +275,14 @@ func uploadToIPFS(c *Context, l *Logger, file []byte, report ReportMsgWithKey) (
return "", err
}

// Connect to local IPFS node
sh := shell.NewShell(c.ipfs)
// Upload the image to IPFS
pngCID, err := sh.Add(pngFile, shell.Pin(true))
if err != nil {
return "", err
}

jpgCID, err := sh.Add(jpgFile, shell.Pin(true))
if err != nil {
return "", err
Expand Down

0 comments on commit 447b091

Please sign in to comment.