title: React Native: Getting the width and height of an image located in DocumentDirectoryPath
body: <p>I am wanting to set images to be 80% of the parent container and a proportional height. I have not been able to find a proper solution to this. The images are stored in <code>DocumentDirectoryPath</code>, so I am trying to get the width and height of these images.</p>
  
  <p>According to the <a href="https://reactnative.dev/docs/image#resolveassetsource" rel="nofollow noreferrer">documentation</a> the resolveAssetSource method works for both local and remote images. It should return the width and height. However, I cannot got it to work. I am also unsure if <code>DocumentDirectoryPath</code> is considered to be a local image or something else.</p>
  
  <p>My code looks like this:</p>
  
  <pre><code>const {width, height) = Image.resolveAssetSource({uri: 'file://' + RNFS.DocumentDirectoryPath + '/mydir/' + group_id + '/images/' + image_name})
  </code></pre>
  
  <p>However, I keep getting <code>undefined</code> for the width and height.</p>
  
  <p>Where am I going wrong here and what can I do to get the width and height of an image stored in DocumentDirectoryPath?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Looking into this further, all the method is returning is an object containing the uri. The object does not contain any other properties such as width and height. Why is it not containing the width and the height?</p>
  
  <p>I also tried connecting to an Internet resource and it is still only providing me with the uri and not the width or height.</p>