diff --git a/client/get_file_information_test.go b/client/get_file_information_test.go index 907f5470..eaa55849 100644 --- a/client/get_file_information_test.go +++ b/client/get_file_information_test.go @@ -204,9 +204,9 @@ func TestGetFileInformation(t *testing.T) { id: testFiles.ProcessedFiles[1].ID, expected: &client.FileInformationHeader{ CacheControl: "max-age=3600", - ContentLength: 4680, + ContentLength: 6640, ContentType: "image/jpeg", - Etag: `"ddb70c1d49808c9613c22aea260da98be45b867a0b0eb37d50f4d04d93dfe37a"`, + Etag: `"4ce6e420e7bb5a1c577a9125ce2bc37f950bb9f25f964112308a452985a17912"`, LastModified: "", Error: "", StatusCode: 200, diff --git a/client/get_file_test.go b/client/get_file_test.go index 6d585768..4c540d1b 100644 --- a/client/get_file_test.go +++ b/client/get_file_test.go @@ -235,7 +235,7 @@ func TestGetFile(t *testing.T) { name: "get image manipulated, if-match==etag", id: testFiles.ProcessedFiles[1].ID, opts: []client.GetFileInformationOpt{ - client.WithIfMatch(`"038cc03024dfcb9c8947fdcbb2a8b092f5da338c08fea0b948ac36b3be1f6ca9"`), + client.WithIfMatch(`"38aae548d455b164041743d5a0131d93b94fd0f13b2d6aed278469ce29f2328b"`), client.WithImageSize(600, 200), client.WithImageQuality(50), client.WithImageBlur(5), @@ -244,14 +244,14 @@ func TestGetFile(t *testing.T) { Filename: "nhost.jpg", FileInformationHeader: &client.FileInformationHeader{ CacheControl: "max-age=3600", - ContentLength: 10913, + ContentLength: 6761, ContentType: "image/jpeg", - Etag: `"038cc03024dfcb9c8947fdcbb2a8b092f5da338c08fea0b948ac36b3be1f6ca9"`, + Etag: `"38aae548d455b164041743d5a0131d93b94fd0f13b2d6aed278469ce29f2328b"`, LastModified: "Tue, 18 Jan 2022 13:18:04 UTC", StatusCode: 200, }, }, - expectedSha: "038cc03024dfcb9c8947fdcbb2a8b092f5da338c08fea0b948ac36b3be1f6ca9", + expectedSha: "38aae548d455b164041743d5a0131d93b94fd0f13b2d6aed278469ce29f2328b", }, { name: "get image manipulated, if-match!=etag", @@ -265,9 +265,9 @@ func TestGetFile(t *testing.T) { expected: &client.FileInformationHeaderWithReader{ FileInformationHeader: &client.FileInformationHeader{ CacheControl: "max-age=3600", - ContentLength: 10913, + ContentLength: 6761, ContentType: "image/jpeg", - Etag: `"038cc03024dfcb9c8947fdcbb2a8b092f5da338c08fea0b948ac36b3be1f6ca9"`, + Etag: `"38aae548d455b164041743d5a0131d93b94fd0f13b2d6aed278469ce29f2328b"`, LastModified: "Tue, 18 Jan 2022 13:18:04 UTC", StatusCode: 412, }, diff --git a/image/image.go b/image/image.go index e8d5c9e4..1d089e60 100644 --- a/image/image.go +++ b/image/image.go @@ -126,12 +126,13 @@ func Manipulate(buf []byte, opts Options) ([]byte, error) { C.size_t(len(buf)), &result, //nolint: exhaustruct C.Options{ - width: C.int(opts.Width), - height: C.int(opts.Height), - crop: C.VIPS_INTERESTING_CENTRE, - size: C.VIPS_SIZE_BOTH, //nolint: gocritic - blur: C.double(opts.Blur), - format: C.ImageType(opts.Format), //nolint: gocritic + quality: C.int(opts.Quality), + width: C.int(opts.Width), + height: C.int(opts.Height), + crop: C.VIPS_INTERESTING_CENTRE, + size: C.VIPS_SIZE_BOTH, //nolint: gocritic + blur: C.double(opts.Blur), + format: C.ImageType(opts.Format), //nolint: gocritic }, ) if err != 0 { diff --git a/image/image_test.go b/image/image_test.go index fce142fb..32e7969e 100644 --- a/image/image_test.go +++ b/image/image_test.go @@ -21,6 +21,19 @@ func TestManipulate(t *testing.T) { size uint64 options image.Options }{ + { + name: "jpg", + filename: "testdata/nhost.jpg", + sum: "a88fdb178a6c476e0cb07bdee7a5ffa62d7197dfe54b67cc4a022a36445c6a32", + size: 33399, + options: image.Options{ + Height: 100, + Width: 300, + Blur: 2, + Quality: 50, + Format: image.ImageTypeJPEG, + }, + }, { name: "jpg", filename: "testdata/nhost.jpg",