()
| 66 | let cancelled = false |
| 67 | |
| 68 | const loadThumbnail = async () => { |
| 69 | try { |
| 70 | let base64Data: string | undefined |
| 71 | |
| 72 | if (image.processedImage) { |
| 73 | base64Data = image.processedImage.base64 |
| 74 | } else if (!image.path.startsWith('clipboard:')) { |
| 75 | const imageData = fs.readFileSync(image.path) |
| 76 | base64Data = imageData.toString('base64') |
| 77 | } |
| 78 | |
| 79 | if (base64Data) { |
| 80 | const sequence = renderInlineImage(base64Data, { |
| 81 | width: INLINE_IMAGE_WIDTH, |
| 82 | height: INLINE_IMAGE_HEIGHT, |
| 83 | filename: image.filename, |
| 84 | }) |
| 85 | if (!cancelled) { |
| 86 | setThumbnailSequence(sequence) |
| 87 | } |
| 88 | } else { |
| 89 | if (!cancelled) { |
| 90 | setThumbnailSequence(null) |
| 91 | } |
| 92 | } |
| 93 | } catch { |
| 94 | // Failed to load image, will show icon fallback |
| 95 | if (!cancelled) { |
| 96 | setThumbnailSequence(null) |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | loadThumbnail() |
| 102 |
no test coverage detected