Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
9aa61726
Commit
9aa61726
authored
3 years ago
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
added unit tests for compression
parent
115353d6
No related branches found
No related tags found
2 merge requests
!117
Release
,
!85
added image compression api
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/utils.go
+6
-7
6 additions, 7 deletions
api/utils.go
api/utils_test.go
+25
-0
25 additions, 0 deletions
api/utils_test.go
with
31 additions
and
7 deletions
api/utils.go
+
6
−
7
View file @
9aa61726
///////////////////////////////////////////////////////////////////////////////
// Copyright © 2020 xx network SEZC //
// //
// Use of this source code is governed by a license that can be found in the //
// LICENSE file //
///////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Copyright © 2021 Privategrity Corporation /
// /
// All rights reserved. /
////////////////////////////////////////////////////////////////////////////////
// Provides various utility functions for access over the bindings
...
...
@@ -65,7 +64,7 @@ func CompressJpeg(imgBytes []byte) ([]byte, error) {
newImg
:=
resize
.
Resize
(
newWidth
,
0
,
img
,
resize
.
Bicubic
)
// Encode the new image to a buffer
var
newImgBuf
*
bytes
.
Buffer
newImgBuf
:=
new
(
bytes
.
Buffer
)
err
=
jpeg
.
Encode
(
newImgBuf
,
newImg
,
nil
)
if
err
!=
nil
{
return
nil
,
errors
.
Errorf
(
"Unable to encode image: %+v"
,
err
)
...
...
This diff is collapsed.
Click to expand it.
api/utils_test.go
+
25
−
0
View file @
9aa61726
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment