mirror of
				https://github.com/gopl-zh/gopl-zh.github.com.git
				synced 2025-10-31 02:03:13 +00:00 
			
		
		
		
	add mkqrcode.go
This commit is contained in:
		
							
								
								
									
										3
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								Makefile
									
									
									
									
									
								
							| @@ -30,6 +30,9 @@ review: | |||||||
| 	gitbook build | 	gitbook build | ||||||
| 	go run zh2tw.go . .md$$ zh2tw | 	go run zh2tw.go . .md$$ zh2tw | ||||||
|  |  | ||||||
|  | qrcode: | ||||||
|  | 	go run mkqrcode.go | ||||||
|  |  | ||||||
| fixlink: | fixlink: | ||||||
| 	go run fixlinks.go . .md$$ | 	go run fixlinks.go . .md$$ | ||||||
|  |  | ||||||
|   | |||||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB | 
							
								
								
									
										33
									
								
								mkqrcode.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								mkqrcode.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | |||||||
|  | // Copyright 2015 <chaishushan{AT}gmail.com>. All rights reserved. | ||||||
|  | // Use of this source code is governed by a BSD-style | ||||||
|  | // license that can be found in the LICENSE file. | ||||||
|  |  | ||||||
|  | // +build ingore | ||||||
|  |  | ||||||
|  | package main | ||||||
|  |  | ||||||
|  | import ( | ||||||
|  | 	"fmt" | ||||||
|  | 	"io/ioutil" | ||||||
|  | 	"log" | ||||||
|  |  | ||||||
|  | 	qr "github.com/chai2010/image/qrencoder" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | const ( | ||||||
|  | 	gopl_zh_url = "http://golang-china.github.io/gopl-zh/" | ||||||
|  | 	output      = "gopl-zh-qrcode.png" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | func main() { | ||||||
|  | 	c, err := qr.Encode(gopl_zh_url, qr.H) | ||||||
|  | 	if err != nil { | ||||||
|  | 		log.Fatal(err) | ||||||
|  | 	} | ||||||
|  | 	err = ioutil.WriteFile(output, c.PNG(), 0666) | ||||||
|  | 	if err != nil { | ||||||
|  | 		log.Fatal(err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	fmt.Println("output:", output) | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user