mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-14 01:46:18 -07:00
fix(test)
This commit is contained in:
parent
1a1ad46155
commit
9c6e6dcf34
2 changed files with 5 additions and 1 deletions
|
|
@ -46,7 +46,7 @@ func TestImageRotate(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestImageConvert(t *testing.T) {
|
func TestImageConvert(t *testing.T) {
|
||||||
buf, err := initImage("test_rotate_out.jpg").Convert(PNG)
|
buf, err := initImage("test.jpg").Convert(PNG)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Cannot process the image: %#v", err)
|
t.Errorf("Cannot process the image: %#v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@ import (
|
||||||
func Resize(buf []byte, o Options) ([]byte, error) {
|
func Resize(buf []byte, o Options) ([]byte, error) {
|
||||||
defer C.vips_thread_shutdown()
|
defer C.vips_thread_shutdown()
|
||||||
|
|
||||||
|
if len(buf) == 0 {
|
||||||
|
return nil, errors.New("Image buffer is empty")
|
||||||
|
}
|
||||||
|
|
||||||
image, imageType, err := vipsRead(buf)
|
image, imageType, err := vipsRead(buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue