Skip to content
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.

Displaying the captured image. #26

Closed
antoinegrant opened this issue May 5, 2015 · 7 comments
Closed

Displaying the captured image. #26

antoinegrant opened this issue May 5, 2015 · 7 comments

Comments

@antoinegrant
Copy link

So I'm to clear as to how we go about displaying the captured image from memory or from disk? Could give an example?

@rt2zz
Copy link
Collaborator

rt2zz commented May 5, 2015

To display the base64 image (i.e. target: Camera.constants.CaptureTarget.memory) the code is roughly

<Image
  source={{
      isStatic: true,
      uri: 'data:image/jpeg;base64,'+base64image,
    }}
  style={{height: 100, width:100}}
  />

where base64image is the string returned by the capture method.

To display the target: disk image, the code is roughly

<Image
  source={{uri: imageURI, isStatic:true}}
  style={{width: 100, height: 100}}
  />

where imageURI is the string returned by the capture method.

You will probably need to play with the width/height, and resizeMode prop to get everything the way you want it.

@antoinegrant
Copy link
Author

That very helpful, thanks.

@Mayzie
Copy link

Mayzie commented May 25, 2017

Hi there,

This does not seem to work any longer on React Native 0.44 for Android. How can I achieve this (displaying a temp, or disk, image)?

@npomfret
Copy link
Collaborator

@Mayzie - what doesn't work? do you have an error or a stack trace from logcat?

@julienvincent
Copy link

Can confirm this no longer works. No problems on a simulator, but does not work on a real device

@julienvincent
Copy link

No nevermind, after reinstalling it works as expected

@pablodance
Copy link

brilliant - thanks very much @rt2zz - saved me some head scratching..

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants