0

How to get height and width of an url from in for an array of image object in useeffect

const imagepushPomise = imgNameArray.map(async (item, index) => {
if 
(index == 0 || index % 3 == 0) 
{ images.push({ url: item, style: "", check: "notboth" })} 
else {
   images.push({ url: item, style: "tall" , height:"", width:"" })                         
}
})

I need to add that object to the else part of the code

VIKASH SR
  • 15
  • 4
  • This will help: https://stackoverflow.com/questions/623172/how-to-get-image-size-height-width-using-javascript. You will have to create an in-memory node using `document.createElement` and set image to it. Then, you can get dimensions – Rajesh Oct 13 '22 at 11:53

0 Answers0