Skip to content

Commit eedf679

Browse files
committed
update README.md
1 parent 73552ee commit eedf679

File tree

2 files changed

+114
-20
lines changed

2 files changed

+114
-20
lines changed

LICENSE

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
MIT License
1+
Copyright (c) 2021 Awen <wengaolng@gmail.com>
22

3-
Copyright (c) 2024 Awen
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
46

5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
7+
http://www.apache.org/licenses/LICENSE-2.0
118

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

README.md

Lines changed: 104 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,104 @@
1-
# go-captcha-assets
2-
This is a Go Captcha assets
1+
# Captcha Assets
2+
Go Captcha presets some default embedded resources and stores them in the Go file format. In addition, you can also configure the CAPTCHA according to your own needs.
3+
4+
## Install
5+
```shell
6+
$ go get -u github.com/wenlng/go-captcha-assets@latest
7+
```
8+
9+
### Chinese Text Assets
10+
```go
11+
import "github.com/wenlng/go-captcha-assets/bindata/chars"
12+
13+
func Demo() {
14+
chars := chars.GetChineseChars()
15+
}
16+
```
17+
18+
### Alpha Text Assets
19+
```go
20+
import "github.com/wenlng/go-captcha-assets/bindata/chars"
21+
22+
func Demo() {
23+
chars := chars.GetAlphaChars()
24+
}
25+
```
26+
27+
### Font Assets
28+
```go
29+
import "github.com/wenlng/go-captcha-assets/resources/fonts/fzshengsksjw"
30+
import "github.com/wenlng/go-captcha-assets/resources/fonts/yrdzst"
31+
32+
func Demo() {
33+
fonts, err := fzshengsksjw.GetFont()
34+
if err != nil {
35+
log.Fatalln(err)
36+
}
37+
38+
// OR
39+
40+
fonts, err := yrdzst.GetFont()
41+
if err != nil {
42+
log.Fatalln(err)
43+
}
44+
}
45+
```
46+
47+
### Image Assets
48+
```go
49+
import "github.com/wenlng/go-captcha-assets/resources/images"
50+
51+
func Demo() {
52+
imgs, err := images.GetImages()
53+
if err != nil {
54+
log.Fatalln(err)
55+
}
56+
}
57+
```
58+
59+
### Shape Assets
60+
```go
61+
import "github.com/wenlng/go-captcha-assets/resources/shapes"
62+
63+
func Demo() {
64+
shapeMaps, err := shapes.GetShapes()
65+
if err != nil {
66+
log.Fatalln(err)
67+
}
68+
}
69+
```
70+
71+
### Thumbnail Assets
72+
```go
73+
import "github.com/wenlng/go-captcha-assets/resources/thumb"
74+
75+
func Demo() {
76+
imgs, err := thumb.GetImages()
77+
if err != nil {
78+
log.Fatalln(err)
79+
}
80+
}
81+
```
82+
83+
### Tile Assets
84+
```go
85+
import "github.com/wenlng/go-captcha-assets/resources/tiles"
86+
87+
func Demo() {
88+
graphs, err := tiles.GetTiles()
89+
if err != nil {
90+
log.Fatalln(err)
91+
}
92+
93+
// slide
94+
var newGraphs = make([]*slide.GraphImage, 0, len(graphs))
95+
for i := 0; i < len(graphs); i++ {
96+
graph := graphs[i]
97+
newGraphs = append(newGraphs, &slide.GraphImage{
98+
OverlayImage: graph.OverlayImage,
99+
MaskImage: graph.MaskImage,
100+
ShadowImage: graph.ShadowImage,
101+
})
102+
}
103+
}
104+
```

0 commit comments

Comments
 (0)