lib/action/updateImageSize.js
function getImageSizeForSource(editor, src, callback) {
		var fileContent;
		if (src) {
			// check if it is data:url
			if (/^data:/.test(src)) {
				fileContent = base64.decode( src.replace(/^data\:.+?;.+?,/, '') );
				return callback(actionUtils.getImageSize(fileContent));
			}

			var filePath = editor.getFilePath();
			file.locateFile(filePath, src, function(absPath) {
				if (absPath === null) {
					throw "Can't find " + src + ' file';
				}

				file.read(absPath, function(err, content) {
					if (err) {
						throw 'Unable to read ' + absPath + ': ' + err;
					}

					content = String(content);
					callback(actionUtils.getImageSize(content));
				});
			});
		}
	}
function getImageSizeForSource(editor, src, callback) {
		var fileContent;
		if (src) {
			// check if it is data:url
			if (/^data:/.test(src)) {
				fileContent = base64.decode( src.replace(/^data\:.+?;.+?,/, '') );
				return callback(actionUtils.getImageSize(fileContent));
			}

			var filePath = editor.getFilePath();
			file.locateFile(filePath, src, function(absPath) {
				if (absPath === null) {
					throw "Can't find " + src + ' file';
				}

				file.read(absPath, function(err, content) {
					if (err) {
						throw 'Unable to read ' + absPath + ': ' + err;
					}

					content = String(content);
					callback(actionUtils.getImageSize(content));
				});
			});
		}
	}
function getImageSizeForSource ( editor , src , callback ) { var fileContent ; if ( src ) { // check if it is data:url if ( / ^data: / . test ( src ) ) { fileContent = base64 . decode ( src . replace ( / ^data\:.+?;.+?, / , '' ) ) ; return callback ( actionUtils . getImageSize ( fileContent ) ) ; } var filePath = editor . getFilePath ( ) ; file . locateFile ( filePath , src , function ( absPath ) { if ( absPath === null ) { throw "Can't find " + src + ' file' ; } file . read ( absPath , function ( err , content ) { if ( err ) { throw 'Unable to read ' + absPath + ': ' + err ; } content = String ( content ) ; callback ( actionUtils . getImageSize ( content ) ) ; } ) ; } ) ; } }
Returns image dimensions for source
@param {IEmmetEditor} editor
@param {String} src Image source (path or data:url)
Returns image dimensions for source