Skip to content
Snippets Groups Projects
Commit 9aa61726 authored by Jake Taylor's avatar Jake Taylor
Browse files

added unit tests for compression

parent 115353d6
No related branches found
No related tags found
2 merge requests!117Release,!85added image compression api
/////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Copyright © 2020 xx network SEZC // // Copyright © 2021 Privategrity Corporation /
// // // /
// Use of this source code is governed by a license that can be found in the // // All rights reserved. /
// LICENSE file // ////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Provides various utility functions for access over the bindings // Provides various utility functions for access over the bindings
...@@ -65,7 +64,7 @@ func CompressJpeg(imgBytes []byte) ([]byte, error) { ...@@ -65,7 +64,7 @@ func CompressJpeg(imgBytes []byte) ([]byte, error) {
newImg := resize.Resize(newWidth, 0, img, resize.Bicubic) newImg := resize.Resize(newWidth, 0, img, resize.Bicubic)
// Encode the new image to a buffer // Encode the new image to a buffer
var newImgBuf *bytes.Buffer newImgBuf := new(bytes.Buffer)
err = jpeg.Encode(newImgBuf, newImg, nil) err = jpeg.Encode(newImgBuf, newImg, nil)
if err != nil { if err != nil {
return nil, errors.Errorf("Unable to encode image: %+v", err) return nil, errors.Errorf("Unable to encode image: %+v", err)
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment