* Displays the image using HTML for web apps * @param {ArrayBuffer} data * @returns {html}
(data)
| 79 | * @returns {html} |
| 80 | */ |
| 81 | present(data) { |
| 82 | if (!data.byteLength) return ""; |
| 83 | const dataArray = new Uint8Array(data); |
| 84 | |
| 85 | const type = isImage(dataArray); |
| 86 | if (!type) { |
| 87 | throw new OperationError("Invalid file type."); |
| 88 | } |
| 89 | |
| 90 | return `<img src="data:${type};base64,${toBase64(dataArray)}">`; |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | export default ImageOpacity; |