(ext)
| 80 | } |
| 81 | |
| 82 | function getMimeType(ext) { |
| 83 | const types = { |
| 84 | '.png': 'image/png', |
| 85 | '.jpg': 'image/jpeg', |
| 86 | '.jpeg': 'image/jpeg', |
| 87 | '.gif': 'image/gif', |
| 88 | '.webp': 'image/webp', |
| 89 | '.bmp': 'image/bmp', |
| 90 | '.svg': 'image/svg+xml', |
| 91 | }; |
| 92 | return types[ext] || 'image/png'; |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Detect if input is just a file path (from drag-and-drop into terminal). |