Source

media/readImageProps.js

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var isStr_1 = __importDefault(require("../string/isStr"));
/**
 * Read the file props of the image
 * @category media
 * @module readImageProps
 */
var readImageProps = function (src) { return new Promise(function (resolve, reject) {
    var img = new Image();
    img.onload = function () { return resolve({
        width: img.width,
        height: img.height,
    }); };
    img.onerror = reject;
    img.src = (0, isStr_1.default)(src) ? src : window.URL.createObjectURL(src);
}); };
exports.default = readImageProps;