⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.1
Server IP:
185.238.29.86
Server:
Linux server2 6.8.12-6-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-6 (2024-12-19T19:05Z) x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.31
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
invoice
/
node_modules
/
pdfmake
/
src
/
View File Name :
imageMeasure.js
'use strict'; var fs = require('fs'); function ImageMeasure(pdfKitDoc, imageDictionary) { this.pdfKitDoc = pdfKitDoc; this.imageDictionary = imageDictionary || {}; } ImageMeasure.prototype.measureImage = function (src) { var image; var that = this; if (!this.pdfKitDoc._imageRegistry[src]) { try { image = this.pdfKitDoc.openImage(realImageSrc(src)); if (!image) { throw 'No image'; } } catch (error) { throw 'Invalid image: ' + error.toString() + '\nImages dictionary should contain dataURL entries (or local file paths in node.js)'; } image.embed(this.pdfKitDoc); this.pdfKitDoc._imageRegistry[src] = image; } else { image = this.pdfKitDoc._imageRegistry[src]; } return { width: image.width, height: image.height }; function realImageSrc(src) { var img = that.imageDictionary[src]; if (!img) { return src; } if (fs.existsSync(img)) { return fs.readFileSync(img); } var index = img.indexOf('base64,'); if (index < 0) { return that.imageDictionary[src]; } return Buffer.from(img.substring(index + 7), 'base64'); } }; module.exports = ImageMeasure;