README
This commit is contained in:
		
							
								
								
									
										13
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								README.md
									
									
									
									
									
								
							@@ -2,6 +2,19 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
提供webp生成服务
 | 
					提供webp生成服务
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```javascript
 | 
				
			||||||
 | 
					// GET /webp/{type}-{id}-{version}-{width}-{height}-{fit}.{format}
 | 
				
			||||||
 | 
					// @type: image avatar article article_attribute ad
 | 
				
			||||||
 | 
					// @id: int 图片ID或是文章ID或是广告ID
 | 
				
			||||||
 | 
					// @version: update_time 时间戳
 | 
				
			||||||
 | 
					// @width: 宽度 1x 2x 3x 倍图直接输入尺寸
 | 
				
			||||||
 | 
					// @height: 高度 1x 2x 3x 倍图直接输入尺寸
 | 
				
			||||||
 | 
					// @fit: 裁切方式 cover contain fill auto
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// GET /img/{type}-{id}.{format}?width=320&height=320&fit=cover
 | 
				
			||||||
 | 
					// 更优雅的实现, 使用查询参数的接口 (不幸的是CDN与OSS都不支持)
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Update
 | 
					## Update
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,7 +39,7 @@ func (m *MysqlConnection) GetImageContent(group string, id string) (content stri
 | 
				
			|||||||
		err = m.db.QueryRow("SELECT image FROM web_article_attribute WHERE id=" + id).Scan(&content)
 | 
							err = m.db.QueryRow("SELECT image FROM web_article_attribute WHERE id=" + id).Scan(&content)
 | 
				
			||||||
	case "ad":
 | 
						case "ad":
 | 
				
			||||||
		err = m.db.QueryRow("SELECT image FROM web_ad WHERE id=" + id).Scan(&content)
 | 
							err = m.db.QueryRow("SELECT image FROM web_ad WHERE id=" + id).Scan(&content)
 | 
				
			||||||
	case "user":
 | 
						case "avatar":
 | 
				
			||||||
		err = m.db.QueryRow("SELECT avatar FROM web_member WHERE id=" + id).Scan(&content)
 | 
							err = m.db.QueryRow("SELECT avatar FROM web_member WHERE id=" + id).Scan(&content)
 | 
				
			||||||
	case "image":
 | 
						case "image":
 | 
				
			||||||
		err = m.db.QueryRow("SELECT content FROM web_images WHERE id=" + id).Scan(&content)
 | 
							err = m.db.QueryRow("SELECT content FROM web_images WHERE id=" + id).Scan(&content)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user