I have an input file tag and I want to get the height and width of user selected image.
class AtomicImage extends Component {
constructor(props) {
super(props);
this.state = {dimensions: {}};
this.onChange = this.onChange.bind(this);
}
onChange = (e) => {
height = ?,
width = ?
}
render(){
const {src} = this.props;
const {width, height} = this.state.dimensions;
return (<div>
<input type="file" onChange={onChange}>
</div>
);
}
}