Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add image overlay to image capture #19

Open
adnanhz opened this issue Nov 19, 2018 · 6 comments
Open

Add image overlay to image capture #19

adnanhz opened this issue Nov 19, 2018 · 6 comments

Comments

@adnanhz
Copy link

adnanhz commented Nov 19, 2018

Hello,

I'd like to add image an overlay image as a guide for image capture. Here's an example I've made on the code by using the browser inspector:

react html 5 camera overlay

I think adding a this.props.children to allow the user to add any child elements they'd like is the best approach to do it.

Thanks.

@MABelanger
Copy link
Owner

@Keftaa
Thank for the suggestion, I'm trying different approach.

@ybv
Copy link

ybv commented Aug 9, 2019

@MABelanger @Keftaa Just curious if this is possible?

@adnanhz
Copy link
Author

adnanhz commented Aug 10, 2019

@ybv I just reviewed what I did back then and I simply used CSS to put a div on top of another. If you're interested, here's a snippet of the code I had written:

<Modal isOpen={this.state.cameraModalOpen}>
          <ModalBody>
            <div style={{width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center'}}>
              <img src="images/photo-outline.png"
                style={{position: 'absolute', width: '65%',
                  height: '74%', opacity: 0.4, zIndex: '1'}} />
                <Camera style={{width: '100%', height: '100%', position: 'absolute', top: 0, left: 0}}
                onTakePhoto = { (dataUri) => { this.onTakePhoto(dataUri); } }
                >

              </Camera>
            </div>

          <Row>
            <Col>
              <h1>Picture Guidelines</h1>

            </Col>
          </Row>
          <Button color="red" onClick={() => {this.setState({cameraModalOpen: false})}}>Cancel</Button>
          </ModalBody>
        </Modal>

@robhung
Copy link

robhung commented Aug 12, 2019

@Keftaa Does the Camera component then take a photo of only what's contained within the overlay, or do you still capture the entire photo with the background?

Also, the Camera component doesn't seem to accept style, did it still work without it?

@ybv
Copy link

ybv commented Aug 23, 2019

thanks for sharing this @Keftaa!

@adnanhz
Copy link
Author

adnanhz commented Aug 23, 2019

@robhung no unfortunately the overlay is for display only.
I don't remember whether style on camera worked or not. But the whole overlay thing worked.

@MABelanger MABelanger reopened this Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants