瀏覽代碼

图片支持系统相册路径

jsonwang 3 年之前
父節點
當前提交
dbbfd98dbe
共有 1 個文件被更改,包括 8 次插入3 次删除
  1. 8 3
      BFFramework/Classes/PQGPUImage/akfilters/PQImageFilter.swift

+ 8 - 3
BFFramework/Classes/PQGPUImage/akfilters/PQImageFilter.swift

@@ -62,10 +62,15 @@ open class PQImageFilter: PQBaseFilter {
         
         autoreleasepool {
             if newImage == nil {
-                let filePath = documensDirectory + (mSticker?.locationPath ?? "")
-                if FileManager.default.fileExists(atPath: filePath) {
+   
+                var imageFilePath = mSticker?.locationPath ?? ""
+                if (!imageFilePath.contains("var/mobile/Media")) {
+                    imageFilePath = documensDirectory + imageFilePath
+                }
+                BFLog(message: "imageFilePath is \(imageFilePath)")
+                if FileManager.default.fileExists(atPath: imageFilePath) {
                     // 有可能是 WEBP
-                    let fileData: Data = try! Data(contentsOf: URL(fileURLWithPath: filePath))
+                    let fileData: Data = try! Data(contentsOf: URL(fileURLWithPath: imageFilePath))
                     if fileData.count != 0, fileData.isWebPFormat {
                         newImage = WebPProcessor.default.process(item: ImageProcessItem.data(fileData), options: KingfisherParsedOptionsInfo([.onlyLoadFirstFrame, .scaleFactor(1)]))
                     }