Get height/width of image in Javascript (ideally without loading the image at all)

前端 未结 4 771
粉色の甜心
粉色の甜心 2020-12-14 09:20

Sorry if this has already been answered, but I can\'t find it if so.

I want to find the height and width of an image file in Javascript. I don\'t actually need to sh

4条回答
  •  春和景丽
    2020-12-14 09:39

    If you check this link here is a method to get all the image dimensions in a directory with PHP which checks it without having to load it to the page. This might help you. You can pass it to your js with a

    var dimensions = 
    

    PHP Get dimensions of images in dir

    I think this is a better approach if you really don't want to load the images

提交回复
热议问题