SDKCameraUtil.h
1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//
// SDKCameraUtil.h
// CameraLibrary
//
// Created by shmily on 16/5/25.
// Copyright © 2016年 HHPacs. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
// 图片是否压缩临界点
#define HHImgReduceSize 1000000
@class AVAssetExportSession;
typedef enum : NSUInteger {
ProTypePacs,
ProTypeUser
} ProType;
@interface SDKCameraUtil : NSObject
/// 是否应该被压缩
@property(nonatomic,assign)BOOL shouldReduce;
/// 家庭医生使用
@property(nonatomic, assign)ProType type;
/// 单例
+ (instancetype)shareInstance;
/// 获取图片bundle
//+ (NSBundle *)getBundle;
/// 根据图片名获取图片
//+ (UIImage *)getImage:(NSString *)imgName;
/// 获取视频的缩略图
/// @param videoURL 视频的URL
/// @param time 截图时间
+ (UIImage *)thumbnailImageForVideo:(NSURL *)videoURL atTime:(NSTimeInterval)time;
/// 根据视频路径获取对应缩略图
//+ (UIImage *)thumImageForVideo:(NSString *)videoPath;
/// 能否被压缩(小于200k不被压缩)
+ (BOOL)isCanReduce:(UIImage *)image;
+ (BOOL)isCanReduceFile:(NSString *)imgPath;
/// 压缩图像后覆盖原图
+ (BOOL)reduceImage:(UIImage *)img path:(NSString *)path;
+ (BOOL)isImage:(NSString *)path;
/// 创建图片的本地路径
///
/// @param prefix 文件头
+ (NSString *)createDocumentPath:(NSString *)prefix;
// 获取图片(视频)缩略图路径
+ (NSString *)getScallPath:(NSString *)fullPath;
/// 写入文件
+ (NSString *)writeImageToFile:(UIImage *)image;
+ (NSString *)writeImageToFile:(UIImage *)image scale:(CGSize)size fullPath:(NSString *)fullPath;
+ (NSString *)writeScaledImg:(UIImage *)image scale:(CGSize)size fullPath:(NSString *)fullPath;
/// 压缩图片
+ (void)zipImages:(NSArray<NSString *> *)imgPaths;
+ (UIImage *)fixOrientation:(UIImage *)aImag;
+ (void)videoFixOrientation: (NSURL *)url path:(NSString *)path finished:(void (^)(AVAssetExportSession *))finishBlock;
+ (Boolean)isIPad;
@end