Skip to content
This repository was archived by the owner on Sep 28, 2021. It is now read-only.

How can load images from phone local. #437

Open
zuijiusi opened this issue Nov 23, 2020 · 3 comments
Open

How can load images from phone local. #437

zuijiusi opened this issue Nov 23, 2020 · 3 comments

Comments

@zuijiusi
Copy link

const imgFunctionArray3 = [
{url: '',props:{source:require('../images/photo_placeholder.png')}},
{url: '',props: { source: { uri: 'content://media/external/images/media/45204'} } },
{url:'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1537850155794&di=4efaecca3f367346ff49c42f8f89d9f2&imgtype=0&src=http%3A%2F%2Fimg3.duitang.com%2Fuploads%2Fitem%2F201206%2F26%2F20120626190359_MjB3s.thumb.700_0.jpeg'}
]

@zuijiusi
Copy link
Author

imgFunctionArray = [
{url: '',props: { source: { uri:'file:/storage/emulated/0/Pictures/Screenshots/Screenshot_20201112-162211.png'} } },
];
the path from my phone local album,but can‘t show in ImageViewer。What should I do

@jaaywags
Copy link

jaaywags commented Dec 1, 2020

I had the same issue. I ended up hosting the image remotely and accessing it that way. Might not be the solution you are looking for but it is a solution.

@sakul-budhathoki
Copy link

Hi @zuijiusi , @jaaywags . I also got issue using local images. I managed to solve it by following code: -

import {Image} from 'react-native';
import LocalImage from './local.png';

<ImageViewer imageUrls={[{ url: Image.resolveAssetSource(LocalImage).uri }]} />

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

3 participants