0

i have one image url(Online url), now i want this image height and width, how can i get this, it's greatly appreciate if anyone answer this

  1. i want to preview the image with 150px height and 150px width, so i set it up in aspx page height-150 and width-150 for img tag

  2. if i assign the above url to img src, it will throw the 150px width and 150px height, but i need the original height and width of the above url image

  3. if i didn't set it up anything for the img tag i will get 0px of height and 0px of width

Can anyone suggest this please?

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
Rasu
  • 27
  • 1
  • 4
  • 1
    Does this answer your question? [Determine original size of image cross browser?](https://stackoverflow.com/questions/1944280/determine-original-size-of-image-cross-browser) – Martin Ferrari Oct 27 '20 at 19:53

2 Answers2

0

You can use the naturalWidth and naturalHeight properties of the img object. See here: Determine original size of image cross browser?

Martin Ferrari
  • 186
  • 1
  • 7
0

if you have the url,you can set up the url as a DIV element's background-image.

and you can display the background whatever you want.

CashLee李秉骏
  • 1,038
  • 1
  • 10
  • 23