troubleshooting Question

how to get image width and height using php or javascript

Avatar of sy_geoffrey
sy_geoffreyFlag for Philippines asked on
JavaScriptPHPWeb Applications
15 Comments1 Solution5188 ViewsLast Modified:
hello everyone.

 i would like to get the width and height of images to be able to display images properly.  i used the getimagesize() function of php. but there are instances where this fails. width and height returned are zeroes. now i started to find workarounds.

i placed a javascript onload function in the img tag. to get the width and height of the img, i used imgObj.width and imgObj.height where imgObj is the img object. still, this returned zeroes. now im wondering how to get the proper image width and height.

am i doing wrong here? how do i get the proper image width and height?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 15 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros