Created
January 6, 2017 07:42
-
-
Save Willib/68fc090a859e63c6b416cd7e082e3dcc to your computer and use it in GitHub Desktop.
iOS中判断一个URL是否为图片路径
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private func imageToAssetURL(url: URL) -> URL?{ | |
let pathExtention = url.pathExtension as CFString | |
let fileUIT = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtention, nil)?.takeRetainedValue() | |
if (UTTypeConformsTo(fileUIT!, kUTTypeImage)){ | |
let param = CXEEngineInitParam() | |
let movieMaker = CXEImageToVideo(videoWidth:Int(param.sequence.width), videoHeight: Int(param.sequence.height)) | |
let fileURL = movieMaker.createMovieFrom(url: url, duration: Int(CXPreparetValue.imageDuration)) | |
return fileURL | |
} | |
return url | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment