Skip to content

Instantly share code, notes, and snippets.

@ospfranco
Last active December 19, 2019 08:32
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ospfranco/88e57cbac8e3e6c55e9859f096a85281 to your computer and use it in GitHub Desktop.
Save ospfranco/88e57cbac8e3e6c55e9859f096a85281 to your computer and use it in GitHub Desktop.
Exif Image Rotation React Component
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