Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
dz_TZImagePickerController
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shuijing
dz_TZImagePickerController
Commits
ea2693f2
Commit
ea2693f2
authored
Mar 04, 2016
by
chenbingiOS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复计算原图大小方法返回结果不准确的问题
parent
6616b9f8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
TZImagePickerController/TZImagePickerController/TZImageManager.m
...PickerController/TZImagePickerController/TZImageManager.m
+9
-7
No files found.
TZImagePickerController/TZImagePickerController/TZImageManager.m
View file @
ea2693f2
...
@@ -242,12 +242,14 @@
...
@@ -242,12 +242,14 @@
/// Get photo bytes 获得一组照片的大小
/// Get photo bytes 获得一组照片的大小
-
(
void
)
getPhotosBytesWithArray
:(
NSArray
*
)
photos
completion
:(
void
(
^
)(
NSString
*
totalBytes
))
completion
{
-
(
void
)
getPhotosBytesWithArray
:(
NSArray
*
)
photos
completion
:(
void
(
^
)(
NSString
*
totalBytes
))
completion
{
__block
NSInteger
dataLength
=
0
;
__block
NSInteger
dataLength
=
0
;
__block
NSInteger
assetCount
=
0
;
for
(
NSInteger
i
=
0
;
i
<
photos
.
count
;
i
++
)
{
for
(
NSInteger
i
=
0
;
i
<
photos
.
count
;
i
++
)
{
TZAssetModel
*
model
=
photos
[
i
];
TZAssetModel
*
model
=
photos
[
i
];
if
([
model
.
asset
isKindOfClass
:[
PHAsset
class
]])
{
if
([
model
.
asset
isKindOfClass
:[
PHAsset
class
]])
{
[[
PHImageManager
defaultManager
]
requestImageDataForAsset
:
model
.
asset
options
:
nil
resultHandler
:^
(
NSData
*
_Nullable
imageData
,
NSString
*
_Nullable
dataUTI
,
UIImageOrientation
orientation
,
NSDictionary
*
_Nullable
info
)
{
[[
PHImageManager
defaultManager
]
requestImageDataForAsset
:
model
.
asset
options
:
nil
resultHandler
:^
(
NSData
*
_Nullable
imageData
,
NSString
*
_Nullable
dataUTI
,
UIImageOrientation
orientation
,
NSDictionary
*
_Nullable
info
)
{
if
(
model
.
type
!=
TZAssetModelMediaTypeVideo
)
dataLength
+=
imageData
.
length
;
if
(
model
.
type
!=
TZAssetModelMediaTypeVideo
)
dataLength
+=
imageData
.
length
;
if
(
i
>=
photos
.
count
-
1
)
{
assetCount
++
;
if
(
assetCount
>=
photos
.
count
)
{
NSString
*
bytes
=
[
self
getBytesFromDataLength
:
dataLength
];
NSString
*
bytes
=
[
self
getBytesFromDataLength
:
dataLength
];
if
(
completion
)
completion
(
bytes
);
if
(
completion
)
completion
(
bytes
);
}
}
...
@@ -403,12 +405,12 @@
...
@@ -403,12 +405,12 @@
-
(
NSString
*
)
getNewAlbumName
:(
NSString
*
)
name
{
-
(
NSString
*
)
getNewAlbumName
:(
NSString
*
)
name
{
if
(
iOS8Later
)
{
if
(
iOS8Later
)
{
NSString
*
newName
;
NSString
*
newName
;
if
([
name
containsString
:
@"Roll"
]
)
newName
=
@"相机胶卷"
;
if
([
name
rangeOfString
:
@"Roll"
].
location
!=
NSNotFound
)
newName
=
@"相机胶卷"
;
else
if
([
name
containsString
:
@"Stream"
]
)
newName
=
@"我的照片流"
;
else
if
([
name
rangeOfString
:
@"Stream"
].
location
!=
NSNotFound
)
newName
=
@"我的照片流"
;
else
if
([
name
containsString
:
@"Added"
]
)
newName
=
@"最近添加"
;
else
if
([
name
rangeOfString
:
@"Added"
].
location
!=
NSNotFound
)
newName
=
@"最近添加"
;
else
if
([
name
containsString
:
@"Selfies"
]
)
newName
=
@"自拍"
;
else
if
([
name
rangeOfString
:
@"Selfies"
].
location
!=
NSNotFound
)
newName
=
@"自拍"
;
else
if
([
name
containsString
:
@"shots"
]
)
newName
=
@"截屏"
;
else
if
([
name
rangeOfString
:
@"shots"
].
location
!=
NSNotFound
)
newName
=
@"截屏"
;
else
if
([
name
containsString
:
@"Videos"
]
)
newName
=
@"视频"
;
else
if
([
name
rangeOfString
:
@"Videos"
].
location
!=
NSNotFound
)
newName
=
@"视频"
;
else
newName
=
name
;
else
newName
=
name
;
return
newName
;
return
newName
;
}
else
{
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment