|  | @@ -36,11 +36,24 @@ open class PQImageFilter: PQBaseFilter {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          mSticker = sticker
 | 
	
		
			
				|  |  |          stickerInfo = sticker
 | 
	
		
			
				|  |  | -        if mSticker!.locationPath.count == 0 {
 | 
	
		
			
				|  |  | -            BFLog(2, message: "图片数据为空,创建失败")
 | 
	
		
			
				|  |  | -            return
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        if(sticker.originalData != nil && (sticker.originalData?.count ?? 0) > 0){
 | 
	
		
			
				|  |  | +            newImage = UIImage.init(data: sticker.originalData!)
 | 
	
		
			
				|  |  | +        }else{
 | 
	
		
			
				|  |  | +            if mSticker!.locationPath.count == 0 {
 | 
	
		
			
				|  |  | +                BFLog(2, message: "图片数据为空,创建失败")
 | 
	
		
			
				|  |  | +                return
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            
 | 
	
		
			
				|  |  | +            var imageFilePath = mSticker?.locationPath ?? ""
 | 
	
		
			
				|  |  | +            if (!imageFilePath.contains("var/mobile/Media")) {
 | 
	
		
			
				|  |  | +                imageFilePath = documensDirectory + imageFilePath
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            BFLog(message: "imageFilePath is \(imageFilePath)")
 | 
	
		
			
				|  |  | +            newImage = UIImage(contentsOfFile:imageFilePath)
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        newImage = UIImage(contentsOfFile: documensDirectory + sticker.locationPath)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          // try find image file frome in BFFramework bundle
 | 
	
		
			
				|  |  |          if newImage == nil {
 | 
	
		
			
				|  |  |              newImage = UIImage.moduleImage(named: sticker.locationPath, moduleName: "BFFramework", isAssets: false)
 | 
	
	
		
			
				|  | @@ -55,10 +68,15 @@ open class PQImageFilter: PQBaseFilter {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          autoreleasepool {
 | 
	
		
			
				|  |  |              if newImage == nil {
 | 
	
		
			
				|  |  | -                let filePath = documensDirectory + (mSticker?.locationPath ?? "")
 | 
	
		
			
				|  |  | -                if FileManager.default.fileExists(atPath: filePath) {
 | 
	
		
			
				|  |  | +                //有可能是webp数据 ,使用 webp 加载
 | 
	
		
			
				|  |  | +                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)]))
 | 
	
		
			
				|  |  |                      }
 |