1

All the examples I've seen people use is the input onChange, but I need it to be from the img tag. Please help!

import React from 'react';
import EXIF from 'exif-js';

const ImageMeta = () => {
  window.onload = getExif;

  function getExif() {
    const img = document.getElementById('image-id')
    EXIF.getData(img, function() {
      const all = EXIF.getAllTags(this);
      console.log(all)
    });
  };

  return (
    <div>
      <img
        id="image-id"
        src="http://fredericiana.com/media/2013/monalisa.jpg"
      />
      <button onClick={() => getExif()}>Click</button>
    </div>
  )
};

export default ImageMeta;
GcodeG01
  • 91
  • 2

0 Answers0