Please enable JavaScript to use RhodeCode Enterprise
Commit Description:
use uuid cookie
Commit Description:
use uuid cookie
'use strict' ;
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 ;
}
var index = img . indexOf ( 'base64,' );
if ( index < 0 ) {
return that . imageDictionary [ src ];
}
return Buffer . from ( img . substring ( index + 7 ), 'base64' );
}
};
module . exports = ImageMeasure ;
Site-wide shortcuts
/
Use quick search box
g h
Goto home page
g g
Goto my private gists page
g G
Goto my public gists page
n r
New repository page
n g
New gist page
Repositories
g s
Goto summary page
g c
Goto changelog page
g f
Goto files page
g F
Goto files page with file search activated
g p
Goto pull requests page
g o
Goto repository settings
g O
Goto repository permissions settings