Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
zhangyongji
/
MRFramework
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
374db0dc
authored
Sep 10, 2019
by
Sarkizz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加图片扩展,用于转换成前端的DataURL格式字符串
parent
ac3c7fe5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
MRFramework/MRFramework.xcodeproj/project.pbxproj
+4
-0
MRFramework/MRFramework/Extensions/UIKit/UIImage+util.swift
+37
-0
No files found.
MRFramework/MRFramework.xcodeproj/project.pbxproj
View file @
374db0dc
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
A70210532320FE8B009F8BC6
/* MRAlbumCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A70210502320FE8B009F8BC6
/* MRAlbumCell.swift */
;
};
A70210532320FE8B009F8BC6
/* MRAlbumCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A70210502320FE8B009F8BC6
/* MRAlbumCell.swift */
;
};
A70210542320FE8B009F8BC6
/* MRCheckBoxImage.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A70210512320FE8B009F8BC6
/* MRCheckBoxImage.swift */
;
};
A70210542320FE8B009F8BC6
/* MRCheckBoxImage.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A70210512320FE8B009F8BC6
/* MRCheckBoxImage.swift */
;
};
A702105823225148009F8BC6
/* SAMutableSelectionAlbum.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A702105723225148009F8BC6
/* SAMutableSelectionAlbum.swift */
;
};
A702105823225148009F8BC6
/* SAMutableSelectionAlbum.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A702105723225148009F8BC6
/* SAMutableSelectionAlbum.swift */
;
};
A7021067232742D7009F8BC6
/* UIImage+util.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A7021066232742D7009F8BC6
/* UIImage+util.swift */
;
};
A73E5C8F23136605000C379B
/* UIColor+util.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A73E5C8E23136605000C379B
/* UIColor+util.swift */
;
};
A73E5C8F23136605000C379B
/* UIColor+util.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A73E5C8E23136605000C379B
/* UIColor+util.swift */
;
};
A73E5C922313767C000C379B
/* UIButton+util.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A73E5C912313767C000C379B
/* UIButton+util.swift */
;
};
A73E5C922313767C000C379B
/* UIButton+util.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A73E5C912313767C000C379B
/* UIButton+util.swift */
;
};
A73E5C95231376D6000C379B
/* NamespaceWrappable.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A73E5C94231376D6000C379B
/* NamespaceWrappable.swift */
;
};
A73E5C95231376D6000C379B
/* NamespaceWrappable.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A73E5C94231376D6000C379B
/* NamespaceWrappable.swift */
;
};
...
@@ -76,6 +77,7 @@
...
@@ -76,6 +77,7 @@
A70210502320FE8B009F8BC6
/* MRAlbumCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MRAlbumCell.swift
;
sourceTree
=
"<group>"
;
};
A70210502320FE8B009F8BC6
/* MRAlbumCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MRAlbumCell.swift
;
sourceTree
=
"<group>"
;
};
A70210512320FE8B009F8BC6
/* MRCheckBoxImage.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MRCheckBoxImage.swift
;
sourceTree
=
"<group>"
;
};
A70210512320FE8B009F8BC6
/* MRCheckBoxImage.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MRCheckBoxImage.swift
;
sourceTree
=
"<group>"
;
};
A702105723225148009F8BC6
/* SAMutableSelectionAlbum.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
SAMutableSelectionAlbum.swift
;
sourceTree
=
"<group>"
;
};
A702105723225148009F8BC6
/* SAMutableSelectionAlbum.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
SAMutableSelectionAlbum.swift
;
sourceTree
=
"<group>"
;
};
A7021066232742D7009F8BC6
/* UIImage+util.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"UIImage+util.swift"
;
sourceTree
=
"<group>"
;
};
A73E5C8E23136605000C379B
/* UIColor+util.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"UIColor+util.swift"
;
sourceTree
=
"<group>"
;
};
A73E5C8E23136605000C379B
/* UIColor+util.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"UIColor+util.swift"
;
sourceTree
=
"<group>"
;
};
A73E5C912313767C000C379B
/* UIButton+util.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"UIButton+util.swift"
;
sourceTree
=
"<group>"
;
};
A73E5C912313767C000C379B
/* UIButton+util.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"UIButton+util.swift"
;
sourceTree
=
"<group>"
;
};
A73E5C94231376D6000C379B
/* NamespaceWrappable.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
NamespaceWrappable.swift
;
sourceTree
=
"<group>"
;
};
A73E5C94231376D6000C379B
/* NamespaceWrappable.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
NamespaceWrappable.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -261,6 +263,7 @@
...
@@ -261,6 +263,7 @@
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
A7B8E139230B9EE200999DF2
/* UIImage+file.swift */
,
A7B8E139230B9EE200999DF2
/* UIImage+file.swift */
,
A7021066232742D7009F8BC6
/* UIImage+util.swift */
,
A7B8E172230FCE4D00999DF2
/* UIScreen+util.swift */
,
A7B8E172230FCE4D00999DF2
/* UIScreen+util.swift */
,
A7B8E174230FDA5200999DF2
/* UIView+util.swift */
,
A7B8E174230FDA5200999DF2
/* UIView+util.swift */
,
A7B8E176230FDEB200999DF2
/* CAGradientLayer+util.swift */
,
A7B8E176230FDEB200999DF2
/* CAGradientLayer+util.swift */
,
...
@@ -564,6 +567,7 @@
...
@@ -564,6 +567,7 @@
A7B8E177230FDEB200999DF2
/* CAGradientLayer+util.swift in Sources */
,
A7B8E177230FDEB200999DF2
/* CAGradientLayer+util.swift in Sources */
,
A73E5CA12314CCBC000C379B
/* String+util.swift in Sources */
,
A73E5CA12314CCBC000C379B
/* String+util.swift in Sources */
,
A70210522320FE8B009F8BC6
/* MRAlbumListViewController.swift in Sources */
,
A70210522320FE8B009F8BC6
/* MRAlbumListViewController.swift in Sources */
,
A7021067232742D7009F8BC6
/* UIImage+util.swift in Sources */
,
);
);
runOnlyForDeploymentPostprocessing
=
0
;
runOnlyForDeploymentPostprocessing
=
0
;
};
};
...
...
MRFramework/MRFramework/Extensions/UIKit/UIImage+util.swift
0 → 100644
View file @
374db0dc
//
// UIImage+util.swift
// MRFramework
//
// Created by Sarkizz on 2019/9/10.
// Copyright © 2019 sarkizz. All rights reserved.
//
import
UIKit
import
Foundation
extension
UIImage
{
public
var
jpegDataURL
:
String
?
{
return
jpegDataURL
()
}
public
func
jpegDataURL
(
_
quality
:
CGFloat
=
1
)
->
String
?
{
if
let
data
=
jpegData
(
compressionQuality
:
quality
),
let
base64
=
data
.
base64String
{
return
formatDataURL
(
with
:
.
image_jpeg
,
dataType
:
.
base64
,
content
:
base64
)
}
return
nil
}
public
var
pngDataURL
:
String
?
{
if
let
data
=
pngData
(),
let
base64
=
data
.
base64String
{
return
formatDataURL
(
with
:
.
image_png
,
dataType
:
.
base64
,
content
:
base64
)
}
return
nil
}
}
extension
UIImage
{
private
func
formatDataURL
(
with
contentType
:
String
.
DataURLContentType
,
dataType
:
String
.
DataURLDataType
,
content
:
String
)
->
String
{
return
"data:"
+
contentType
.
rawValue
+
";"
+
dataType
.
rawValue
+
","
+
content
}
}
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