i have a landscape and portrait image. how can i pop up it correctly ?
my pop up:
<Modal
visible={this.state.visible}
width="600"
height="400"
effect="fadeInUp"
onClickAway={() => this.closeModal()}
>
<div>
<img
src={"/img/" + this.state.LinkName}
width="600"
height="400"
alt="Houston We have pb"
/>
my idea, i will add "land" and "portrait" string to each image.
so i can test this.state.LinkName.contains("Land")
then
width = 600 and height = 400
else width = 400 and height = 600
how can i do that in react ?
i am newbie in react technologie.
i modifie the code :
handleButtonClick = (e, row) => {
var bild = new Image();
bild.src = "/img/" + row.original.Cert;
//Image.getSize(bild.src, (width, height) => {this.setState({width, height})});
//const {width, height} = Image.resolveAssetSource(bild.src);
var Pos
bild.onload = function()
{
Pos = bild.width > bild.height ? "Land" : "Port";
}
this.setState({ visible: true, LinkName: row.original.Cert, ThePos: Pos });
};
Now i get the real width and height.
the problem now, the variable ThePos is always undifined.