GetImageDimensions 获取图片尺寸
(path string)
| 66 | |
| 67 | // GetImageDimensions 获取图片尺寸 |
| 68 | func (p *Processor) GetImageDimensions(path string) (width, height int, err error) { |
| 69 | file, err := os.Open(path) |
| 70 | if err != nil { |
| 71 | return 0, 0, err |
| 72 | } |
| 73 | defer func() { _ = file.Close() }() |
| 74 | |
| 75 | img, _, err := image.DecodeConfig(file) |
| 76 | if err != nil { |
| 77 | return 0, 0, err |
| 78 | } |
| 79 | |
| 80 | return img.Width, img.Height, nil |
| 81 | } |
| 82 | |
| 83 | // ValidateVideo 验证视频 |
| 84 | func (p *Processor) ValidateVideo(video *Video) error { |