本文整理匯總了Golang中github.com/pierrre/imageserver.Params.GetParams方法的典型用法代碼示例。如果您正苦於以下問題:Golang Params.GetParams方法的具體用法?Golang Params.GetParams怎麽用?Golang Params.GetParams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/pierrre/imageserver.Params
的用法示例。
在下文中一共展示了Params.GetParams方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Change
// Change implements Processor.
func (proc *Processor) Change(params imageserver.Params) bool {
if !params.Has(Param) {
return false
}
params, err := params.GetParams(Param)
if err != nil {
return true
}
if params.Empty() {
return false
}
if params.Has("width") {
return true
}
if params.Has("height") {
return true
}
if params.Has("interpolation") {
return true
}
if params.Has("mode") {
return true
}
return false
}
示例2: Get
// Get implements Server.
func (srv *ValidateParamsServer) Get(params imageserver.Params) (*imageserver.Image, error) {
if params.Has(Param) {
params, err := params.GetParams(Param)
if err != nil {
return nil, err
}
err = srv.validate(params)
if err != nil {
return nil, wrapParamError(err)
}
}
return srv.Server.Get(params)
}
示例3: Process
// Process implements Processor.
func (proc *Processor) Process(nim image.Image, params imageserver.Params) (image.Image, error) {
if !params.Has(Param) {
return nim, nil
}
params, err := params.GetParams(Param)
if err != nil {
return nil, err
}
nim, err = process(nim, params)
if err != nil {
return nil, wrapParamError(err)
}
return nim, nil
}
示例4: Change
// Change implements imageserver/image.Processor.
func (prc *RotateProcessor) Change(params imageserver.Params) bool {
if !params.Has(rotateParam) {
return false
}
params, err := params.GetParams(rotateParam)
if err != nil {
return true
}
if params.Empty() {
return false
}
if params.Has("rotation") {
return true
}
return false
}
示例5: Process
// Process implements imageserver/image.Processor.
func (prc *Processor) Process(im image.Image, params imageserver.Params) (image.Image, error) {
if !params.Has(param) {
return im, nil
}
params, err := params.GetParams(param)
if err != nil {
return nil, err
}
im, err = prc.process(im, params)
if err != nil {
if err, ok := err.(*imageserver.ParamError); ok {
err.Param = param + "." + err.Param
}
return nil, err
}
return im, nil
}
示例6: Change
// Change implements imageserver/image.Processor.
func (prc *ResizeProcessor) Change(params imageserver.Params) bool {
if !params.Has(resizeParam) {
return false
}
params, err := params.GetParams(resizeParam)
if err != nil {
return true
}
if params.Empty() {
return false
}
if params.Has("width") {
return true
}
if params.Has("height") {
return true
}
return false
}
示例7: Handle
// Handle implements imageserver.Handler.
func (hdr *Handler) Handle(im *imageserver.Image, params imageserver.Params) (*imageserver.Image, error) {
if !params.Has(param) {
return im, nil
}
params, err := params.GetParams(param)
if err != nil {
return nil, err
}
if params.Empty() {
return im, nil
}
im, err = hdr.handle(im, params)
if err != nil {
if err, ok := err.(*imageserver.ParamError); ok {
err.Param = param + "." + err.Param
}
return nil, err
}
return im, nil
}
示例8: Process
// Process implements Processor.
func (prc *Processor) Process(nim image.Image, params imageserver.Params) (image.Image, error) {
if !params.Has(Param) {
return nim, nil
}
params, err := params.GetParams(Param)
if err != nil {
return nil, err
}
if params.Empty() {
return nim, nil
}
nim, err = prc.process(nim, params)
if err != nil {
if err, ok := err.(*imageserver.ParamError); ok {
err.Param = fmt.Sprintf("%s.%s", Param, err.Param)
}
return nil, err
}
return nim, nil
}
示例9: Get
// Get implements Server.
func (server *Server) Get(params imageserver.Params) (*imageserver.Image, error) {
im, err := server.Server.Get(params)
if err != nil {
return nil, err
}
if !params.Has(globalParam) {
return im, nil
}
params, err = params.GetParams(globalParam)
if err != nil {
return nil, err
}
if params.Empty() {
return im, nil
}
im, err = server.process(im, params)
if err != nil {
if err, ok := err.(*imageserver.ParamError); ok {
err.Param = globalParam + "." + err.Param
}
return nil, err
}
return im, nil
}