mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-30 18:22:37 -04:00 
			
		
		
		
	* Support HEIC/HEIF backup * Storing backup directly from original file from the phone * Directly read and backup video file - Improve performance on video backup
		
			
				
	
	
		
			40 lines
		
	
	
		
			950 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			950 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
| import 'package:path/path.dart' as p;
 | |
| 
 | |
| class FileHelper {
 | |
|   static getMimeType(String filePath) {
 | |
|     var fileExtension = p.extension(filePath).split(".")[1];
 | |
| 
 | |
|     switch (fileExtension.toLowerCase()) {
 | |
|       case 'gif':
 | |
|         return {"type": "image", "subType": "gif"};
 | |
| 
 | |
|       case 'jpeg':
 | |
|         return {"type": "image", "subType": "jpeg"};
 | |
| 
 | |
|       case 'jpg':
 | |
|         return {"type": "image", "subType": "jpeg"};
 | |
| 
 | |
|       case 'png':
 | |
|         return {"type": "image", "subType": "png"};
 | |
| 
 | |
|       case 'mov':
 | |
|         return {"type": "video", "subType": "quicktime"};
 | |
| 
 | |
|       case 'mp4':
 | |
|         return {"type": "video", "subType": "mp4"};
 | |
| 
 | |
|       case 'avi':
 | |
|         return {"type": "video", "subType": "x-msvideo"};
 | |
| 
 | |
|       case 'heic':
 | |
|         return {"type": "image", "subType": "heic"};
 | |
| 
 | |
|       case 'heif':
 | |
|         return {"type": "image", "subType": "heif"};
 | |
| 
 | |
|       default:
 | |
|         return {"type": "unsupport", "subType": "unsupport"};
 | |
|     }
 | |
|   }
 | |
| }
 |