@wordpress/upload-media
Version:
Core media upload logic.
34 lines (33 loc) • 883 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ImageFile = void 0;
/**
* ImageFile class.
*
* Small wrapper around the `File` class to hold
* information about current dimensions and original
* dimensions, in case the image was resized.
*/
class ImageFile extends File {
width = 0;
height = 0;
originalWidth = 0;
originalHeight = 0;
get wasResized() {
return (this.originalWidth || 0) > this.width || (this.originalHeight || 0) > this.height;
}
constructor(file, width, height, originalWidth, originalHeight) {
super([file], file.name, {
type: file.type,
lastModified: file.lastModified
});
this.width = width;
this.height = height;
this.originalWidth = originalWidth;
this.originalHeight = originalHeight;
}
}
exports.ImageFile = ImageFile;
//# sourceMappingURL=image-file.js.map
;