You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
527 B
26 lines
527 B
package model |
|
|
|
import "go-common/library/database/bfs" |
|
|
|
const ( |
|
_defaultPaddingX = 10 |
|
_defaultPaddingY = 10 |
|
_defaultScale = 0.035 |
|
) |
|
|
|
// TweakWatermark makes some attributes of watermark default if they are not legal. |
|
func TweakWatermark(req *bfs.Request) { |
|
if req.WMKey != "" || req.WMText != "" { |
|
if req.WMPaddingX == 0 { |
|
req.WMPaddingX = _defaultPaddingX |
|
} |
|
|
|
if req.WMPaddingY == 0 { |
|
req.WMPaddingY = _defaultPaddingY |
|
} |
|
|
|
if req.WMScale <= 0 || req.WMScale >= 1 { |
|
req.WMScale = _defaultScale |
|
} |
|
} |
|
}
|
|
|