Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ysqi/splitimage

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

切图服务

WEB服务对服务器图片进行切割处理,按指定将大图切成若干份小图。

安装

go get github.com/ysqi/splitimage
cd $GOPATH/github.com/ysqi/splitimage
go build

配置

配置文件在文件夹conf下 app.conf

    # 服务运行端口,默认为8080
    httpport = 8080 
    runmode = prod
    # 缩略图大小控制,为0或负数时表示无限制
    thubMaxLen = 2000

运行服务

在Liunx下运行:$ ./splitimage ,在 Windown 下双击运行spliteimage.exe 即可。

注意 因为服务需要访问服务器图片资源,请确保服务有权限访问图片资源

服务调用

本机测试,浏览器访问 http://localhost:8080/image/split?src=XXX&length=XXX&save=XXX

参数说明

  • src : 待切片图片路径
  • length: 切后图片最大高宽
  • save: 切图保存位置

实例

http://localhost:8080/image/split?src=C:\new.png&length=400&save=C:\NEW\

切片成功返回消息:

{
    "success":true,
    "msg":"",
    "data":{
        "x":2,
        "y":3
    }
}

如果切片失败则返回:

{
    "success":false,
    "msg":"文件不存在"
}

About

图片切割服务

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.