mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-27 13:56:25 +02:00
added validuntil option
Co-authored-by: Will Norris <will@willnorris.com>
This commit is contained in:
parent
b98b3455a1
commit
0a407313b2
5 changed files with 58 additions and 5 deletions
|
|
@ -7,6 +7,7 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
var emptyOptions = Options{}
|
||||
|
|
@ -25,8 +26,8 @@ func TestOptions_String(t *testing.T) {
|
|||
"1x2,fh,fit,fv,q80,r90",
|
||||
},
|
||||
{
|
||||
Options{Width: 0.15, Height: 1.3, Rotate: 45, Quality: 95, Signature: "c0ffee", Format: "png"},
|
||||
"0.15x1.3,png,q95,r45,sc0ffee",
|
||||
Options{Width: 0.15, Height: 1.3, Rotate: 45, Quality: 95, Signature: "c0ffee", Format: "png", ValidUntil: time.Unix(123, 0)},
|
||||
"0.15x1.3,png,q95,r45,sc0ffee,vu123",
|
||||
},
|
||||
{
|
||||
Options{Width: 0.15, Height: 1.3, CropX: 100, CropY: 200},
|
||||
|
|
@ -86,7 +87,7 @@ func TestParseOptions(t *testing.T) {
|
|||
// flags, in different orders
|
||||
{"q70,1x2,fit,r90,fv,fh,sc0ffee,png", Options{Width: 1, Height: 2, Fit: true, Rotate: 90, FlipVertical: true, FlipHorizontal: true, Quality: 70, Signature: "c0ffee", Format: "png"}},
|
||||
{"r90,fh,sc0ffee,png,q90,1x2,fv,fit", Options{Width: 1, Height: 2, Fit: true, Rotate: 90, FlipVertical: true, FlipHorizontal: true, Quality: 90, Signature: "c0ffee", Format: "png"}},
|
||||
{"cx100,cw300,1x2,cy200,ch400,sc,scaleUp", Options{Width: 1, Height: 2, ScaleUp: true, CropX: 100, CropY: 200, CropWidth: 300, CropHeight: 400, SmartCrop: true}},
|
||||
{"cx100,cw300,1x2,cy200,ch400,sc,scaleUp,vu1234567890", Options{Width: 1, Height: 2, ScaleUp: true, CropX: 100, CropY: 200, CropWidth: 300, CropHeight: 400, SmartCrop: true, ValidUntil: time.Unix(1234567890, 0)}},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue