Last active
December 19, 2019 08:32
-
-
Save ospfranco/88e57cbac8e3e6c55e9859f096a85281 to your computer and use it in GitHub Desktop.
Exif Image Rotation React Component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import * as Reactdom from 'react-dom'; | |
import * as loadimage from 'blueimp-load-image'; | |
class ImageViewer extends React.Component<any, any> { | |
private imageCanvas; | |
public componentDidMount() { | |
loadimage('IMAGE_URL', (img) => { | |
img.className = 'fit_to_parent'; // css class: { max-width: 100%; max-height: 100%; } | |
Reactdom.findDOMNode(this.imageCanvas).appendChild(img); | |
}); | |
} | |
public render() { | |
return ( | |
<div | |
style={{width: '100%', height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center'}} | |
ref={(ref) => this.imageCanvas = ref} | |
/>); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment