You can use javascript to obtain the width and height of an image. To prevent data errors caused by incomplete image loading, the onreadystatechange event ensures the width of the image, high data accuracy. The Code is as follows:
Var image = new Image (); image. src = 'HTTP: // loads () {if (image. readyState = 'complete') {alert ("the width and height of the image obtained through js are:" + image. width + '-' + image. height );}}
Articles you may be interested in
- Js address bar special effects (display the size of all images with links on the page and view the height of the current browser)
- Js checks whether the image is loaded and obtains the image width.
- Php obtains the screen width, height, and resolution of the client computer.
- Automatically adjust the image width during webpage Loading
- Js obtains the height of the scroll bar from the top and bottom of the browser. It is compatible with ie and firefox.
- Powerful PHP image processing class (watermark, transparency, zoom, sharpen, rotate, flip, cut, reversed)
- JQuery obtains the height and width of the visible area of the browser window, and the height of the scroll bar.
- Image zoom-in display special effects slimbox the most lightweight function the most powerful Jquery Image zoom-in special effects